changeset 1706:9fc738581a9d

[xemacs-hg @ 2003-09-22 03:21:12 by james] Remove GNU DLD support, fix the C++ build, make eval-related functions visible to modules, and fix minor Windows-related problems.
author james
date Mon, 22 Sep 2003 03:21:19 +0000
parents cdbc76885304
children fca75a427ae3
files lib-src/ChangeLog lib-src/ellcc.c modules/ChangeLog modules/ldap/eldap.c modules/postgresql/postgresql.c src/ChangeLog src/device-x.c src/emacs.c src/emodules.c src/lisp.h src/objects-msw.c src/symsinit.h src/sysdll.c src/sysdll.h src/xemacs.def.in.in
diffstat 15 files changed, 235 insertions(+), 215 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/ChangeLog	Sun Sep 21 21:52:23 2003 +0000
+++ b/lib-src/ChangeLog	Mon Sep 22 03:21:19 2003 +0000
@@ -1,3 +1,8 @@
+2003-09-21  Jerry James  <james@xemacs.org>
+
+	* ellcc.c (do_init_mode): Do not mangle external symbols in the
+	generated doc file with C++ so that emodules.c can find them.
+
 2003-09-15  Jerry James  <james@xemacs.org>
 
 	* make-dump-id.c (main): Output separate declaration and
--- a/lib-src/ellcc.c	Sun Sep 21 21:52:23 2003 +0000
+++ b/lib-src/ellcc.c	Mon Sep 22 03:21:19 2003 +0000
@@ -715,13 +715,20 @@
     }
   fprintf (mout, "/* DO NOT EDIT - AUTOMATICALLY GENERATED */\n\n");
   fprintf (mout, "#include <emodules.h>\n\n");
+  fprintf (mout, "#ifdef __cplusplus\n");
+  fprintf (mout, "extern \"C\" {\n");
+  fprintf (mout, "#endif\n");
+  fprintf (mout, "extern const long emodule_compiler;\n");
+  fprintf (mout, "extern const char *emodule_name, *emodule_version, *emodule_title;\n");
+  fprintf (mout, "extern void docs_of_%s (void);\n", SSTR(mod_name));
+  fprintf (mout, "#ifdef __cplusplus\n");
+  fprintf (mout, "}\n");
+  fprintf (mout, "#endif\n\n");
   fprintf (mout, "const long emodule_compiler = %ld;\n", EMODULES_REVISION);
   fprintf (mout, "const char *emodule_name = \"%s\";\n", SSTR(mod_name));
   fprintf (mout, "const char *emodule_version = \"%s\";\n", SSTR(mod_version));
-  fprintf (mout, "const char *emodule_title = \"%s\";\n", SSTR(mod_title));
-  fprintf (mout, "\n\n");
-  fprintf (mout, "void docs_of_%s (void);\n", SSTR(mod_name));
-  fprintf (mout, "void docs_of_%s (void)\n", SSTR(mod_name));
+  fprintf (mout, "const char *emodule_title = \"%s\";\n\n", SSTR(mod_title));
+  fprintf (mout, "void docs_of_%s ()\n", SSTR(mod_name));
   if (fclose (mout) != 0)
     {
       fatal ("Failed to close output file %s", mod_output);
--- a/modules/ChangeLog	Sun Sep 21 21:52:23 2003 +0000
+++ b/modules/ChangeLog	Mon Sep 22 03:21:19 2003 +0000
@@ -1,3 +1,9 @@
+2003-09-21  Jerry James  <james@xemacs.org>
+
+	* postgresql/postgresql.c (unload_postgresql): Do not mangle the
+	unload function name when compiling with C++.
+	* ldap/eldap.c (unload_eldap): Ditto.
+
 2003-09-03  Steve Youngs  <youngs@xemacs.org>
 
 	* XEmacs 21.5.15 "celery" is released.
--- a/modules/ldap/eldap.c	Sun Sep 21 21:52:23 2003 +0000
+++ b/modules/ldap/eldap.c	Mon Sep 22 03:21:19 2003 +0000
@@ -856,7 +856,7 @@
 }
 
 #ifdef HAVE_SHLIB
-void unload_eldap (void);
+EXTERN_C void unload_eldap (void);
 void
 unload_eldap (void)
 {
--- a/modules/postgresql/postgresql.c	Sun Sep 21 21:52:23 2003 +0000
+++ b/modules/postgresql/postgresql.c	Mon Sep 22 03:21:19 2003 +0000
@@ -1862,7 +1862,7 @@
 }
 
 #ifdef HAVE_SHLIB
-void unload_postgresql (void);
+EXTERN_C void unload_postgresql (void);
 void
 unload_postgresql (void)
 {
--- a/src/ChangeLog	Sun Sep 21 21:52:23 2003 +0000
+++ b/src/ChangeLog	Mon Sep 22 03:21:19 2003 +0000
@@ -1,3 +1,29 @@
+2003-09-21  Jerry James  <james@xemacs.org>
+
+	* device-x.c (x_init_device): dll_open now takes a Lisp_Object.
+	* emacs.c (make_arg_list_1): Remove useless call to dll_init.
+	* emacs.c (main_1): Ditto.
+	* emodules.c: char to CIbyte conversion.
+	* emodules.c (Fload_module): Ditto.
+	* emodules.c (Funload_module): Ditto.
+	* emodules.c (find_make_module): Ditto, and use NULL.
+	* emodules.c (emodules_load): Ditto, and pass Lisp_Objects to and
+	from the sysdll routines.  Be careful about string conversions.
+	* emodules.c (reinit_vars_of_module): Use NULL.
+	* objects-msw.c (mswindows_find_charset_font): Fix call to
+	mswindows_list_fonts broken by James LewisMoss' Sept 20 change.
+	* symsinit.h: Do not mangle module initialization function names.
+	* sysdll.c (MAYBE_PREPEND_UNDERSCORE): char to CIbyte conversion.
+	* sysdll.c (dll_init): char to Extbyte conversion.
+	* sysdll.c (dll_open): Take a Lisp_Object, possibly Qnil.
+	* sysdll.c (dll_function): char to CIbyte conversion.
+	* sysdll.c (dll_variable): Ditto.
+	* sysdll.c (dll_error): Return a Lisp_Object, not a string.
+	* sysdll.c (dll_close): Cast appropriately for C++.
+	* sysdll.h: Change prototypes as per sysdll.c changes.
+	* lisp.h: Make eval-related functions visible to modules.
+	* xemacs.def.in.in: Ditto.
+
 2003-09-20  Ilya N. Golubev  <gin@mo.msk.ru>
 
 	* cmdloop.c (Fcommand_loop_1): Allow specifying elisp function for
--- a/src/device-x.c	Sun Sep 21 21:52:23 2003 +0000
+++ b/src/device-x.c	Mon Sep 22 03:21:19 2003 +0000
@@ -538,7 +538,7 @@
 
   {
     /* Get a dll handle to the main process. */
-    dll_handle xaw_dll_handle = dll_open (NULL);
+    dll_handle xaw_dll_handle = dll_open (Qnil);
 
     /* Did that fail?  If so, continue without error.
      * We could die here but, well, that's unfriendly and all -- plus I feel
--- a/src/emacs.c	Sun Sep 21 21:52:23 2003 +0000
+++ b/src/emacs.c	Mon Sep 22 03:21:19 2003 +0000
@@ -524,17 +524,6 @@
 	      fullpath = build_tstr_string (full_exe_path);
 	      xfree (full_exe_path);
 	      result = Fcons (fullpath, result);
-#ifdef HAVE_SHLIB
-	      {
-		Extbyte *fullpathext;
-
-		/* Don't use full_exe_path directly because it's probably
-		   in a different format. */
-		LISP_STRING_TO_EXTERNAL (fullpath, fullpathext,
-					 Qdll_filename_encoding);
-		(void) dll_init (fullpathext);
-	      }
-#endif
 	    }
 	  else
 #endif
@@ -2356,23 +2345,6 @@
       Vinvocation_directory = Ffile_name_directory (Vinvocation_directory);
     }
 
-#if defined (HAVE_SHLIB) && !defined (WIN32_NATIVE)
-  /* This is Unix only.  MS Windows NT has a library call that does
-     The Right Thing on that system.  Rumor has it, this must be
-     called for GNU dld in temacs and xemacs.  */
-  {
-    char *buf = (char *)ALLOCA (XSTRING_LENGTH (Vinvocation_directory)
-				+ XSTRING_LENGTH (Vinvocation_name)
-				+ 2);
-    sprintf (buf, "%s/%s", XSTRING_DATA (Vinvocation_directory),
-	     XSTRING_DATA (Vinvocation_name));
-
-    C_STRING_TO_EXTERNAL (buf, buf, Qfile_name);
-    /* All we can do is cry if an error happens, so ignore it. */
-    (void) dll_init (buf);
-  }
-#endif
-
 #if defined (LOCALTIME_CACHE) && defined (HAVE_TZSET)
   /* sun's localtime() has a bug.  it caches the value of the time
      zone rather than looking it up every time.  Since localtime() is
--- a/src/emodules.c	Sun Sep 21 21:52:23 2003 +0000
+++ b/src/emodules.c	Mon Sep 22 03:21:19 2003 +0000
@@ -41,10 +41,10 @@
 typedef struct _emodules_list
 {
   int used;             /* Is this slot used?                              */
-  char *soname;         /* Name of the shared object loaded (full path)    */
-  char *modname;        /* The name of the module                          */
-  char *modver;         /* The module version string                       */
-  char *modtitle;       /* How the module announces itself                 */
+  CIbyte *soname;       /* Name of the shared object loaded (full path)    */
+  CIbyte *modname;      /* The name of the module                          */
+  CIbyte *modver;       /* The module version string                       */
+  CIbyte *modtitle;     /* How the module announces itself                 */
   void (*unload)(void); /* Module cleanup function to run before unloading */
   dll_handle dlhandle;  /* Dynamic lib handle                              */
 } emodules_list;
@@ -56,8 +56,8 @@
 static emodules_list *modules;
 static int modnum;
 
-static int find_make_module (const char *mod, const char *name,
-			     const char *ver, int make_or_find);
+static int find_make_module (const CIbyte *mod, const CIbyte *name,
+			     const CIbyte *ver, int make_or_find);
 static Lisp_Object module_load_unwind (Lisp_Object);
 static void attempt_module_delete (int mod);
 
@@ -91,22 +91,22 @@
 */
        (file, name, version))
 {
-  char *mod, *mname, *mver;
+  CIbyte *mod, *mname, *mver;
   int speccount = specpdl_depth();
 
   CHECK_STRING(file);
 
-  mod = (char *)XSTRING_DATA (file);
+  mod = (CIbyte *) XSTRING_DATA (file);
 
   if (NILP (name))
     mname = "";
   else
-    mname = (char *)XSTRING_DATA (name);
+    mname = (CIbyte *) XSTRING_DATA (name);
 
   if (NILP (version))
     mver = "";
   else
-    mver = (char *)XSTRING_DATA (version);
+    mver = (CIbyte *) XSTRING_DATA (version);
 
   dlhandle = 0;
   record_unwind_protect (module_load_unwind, make_int(modnum));
@@ -131,7 +131,7 @@
        (file, name, version))
 {
   int x;
-  char *mod, *mname, *mver;
+  CIbyte *mod, *mname, *mver;
   Lisp_Object foundname = Qnil;
   struct gcpro gcpro1;
 
@@ -141,18 +141,18 @@
   if (locate_file (Vmodule_load_path, file, Vmodule_extensions, &foundname, 0)
       < 0)
     return Qt;
-  mod = (char *)XSTRING_DATA (foundname);
+  mod = (CIbyte *) XSTRING_DATA (foundname);
   UNGCPRO;
 
   if (NILP (name))
     mname = "";
   else
-    mname = (char *)XSTRING_DATA (name);
+    mname = (CIbyte *) XSTRING_DATA (name);
 
   if (NILP (version))
     mver = "";
   else
-    mver = (char *)XSTRING_DATA (version);
+    mver = (CIbyte *) XSTRING_DATA (version);
 
   x = find_make_module (mod, mname, mver, 1);
   if (x != -1)
@@ -204,7 +204,8 @@
 }
 
 static int
-find_make_module (const char *mod, const char *name, const char *ver, int mof)
+find_make_module (const CIbyte *mod, const CIbyte *name, const CIbyte *ver,
+		  int mof)
 {
   int i, fs = -1;
 
@@ -232,7 +233,7 @@
    * We only get here if we haven't found a free slot and the module was
    * not previously loaded.
    */
-  if (modules == (emodules_list *)0)
+  if (modules == NULL)
     modules = (emodules_list *) xmalloc (sizeof (emodules_list));
   modnum++;
   modules = (emodules_list *) xrealloc (modules, modnum * sizeof (emodules_list));
@@ -324,16 +325,17 @@
  * the cleaning up.
  */
 void
-emodules_load(const char *module, const char *modname, const char *modver)
+emodules_load (const CIbyte *module, const CIbyte *modname,
+	       const CIbyte *modver)
 {
   Lisp_Object old_load_list;
   Lisp_Object filename;
   Lisp_Object foundname, lisp_modname;
   int x, mpx;
-  char *soname;
-  const char **f;
+  CIbyte *soname;
+  const CIbyte **f;
   const long *ellcc_rev;
-  char *mver, *mname, *mtitle, *symname;
+  CIbyte *mver, *mname, *mtitle, *symname;
   void (*modload)(void) = 0;
   void (*modsyms)(void) = 0;
   void (*modvars)(void) = 0;
@@ -348,7 +350,7 @@
   emodules_depth++;
   dlhandle = 0;
 
-  if ((module == (const char *)0) || (module[0] == '\0'))
+  if (module == NULL || module[0] == '\0')
     invalid_argument ("Empty module name", Qunbound);
 
   GCPRO4(filename, foundname, old_load_list, lisp_modname);
@@ -357,51 +359,47 @@
 		   &foundname, 0) < 0)
     signal_error (Qdll_error, "Cannot open dynamic module", filename);
 
-  soname = (char *)ALLOCA (XSTRING_LENGTH (foundname) + 1);
-  strcpy (soname, (char *)XSTRING_DATA (foundname));
+  LISP_STRING_TO_EXTERNAL (foundname, soname, Qfile_name);
   lisp_modname = call1 (Qfile_name_sans_extension,
 			Ffile_name_nondirectory (foundname));
 
-  dlhandle = dll_open (soname);
-  if (dlhandle == (dll_handle)0)
+  dlhandle = dll_open (foundname);
+  if (dlhandle == NULL)
     {
-      Ibyte *dllerrint;
-
-      EXTERNAL_TO_C_STRING (dll_error (dlhandle), dllerrint, Qnative);
       signal_error (Qdll_error, "Opening dynamic module",
-		    build_intstring (dllerrint));
+		    dll_error (dlhandle));
     }
 
   ellcc_rev = (const long *)dll_variable (dlhandle, "emodule_compiler");
-  if ((ellcc_rev == (const long *)0) || (*ellcc_rev <= 0))
+  if (ellcc_rev == NULL || *ellcc_rev <= 0L)
     signal_error (Qdll_error, "Invalid dynamic module: Missing symbol `emodule_compiler'", Qunbound);
   if (*ellcc_rev > EMODULES_REVISION)
     signal_ferror (Qdll_error, "Invalid dynamic module: Unsupported version `%ld(%ld)'", *ellcc_rev, EMODULES_REVISION);
 
-  f = (const char **)dll_variable (dlhandle, "emodule_name");
-  if ((f == (const char **)0) || (*f == (const char *)0))
+  f = (const CIbyte **) dll_variable (dlhandle, "emodule_name");
+  if (f == NULL || *f == NULL)
     signal_error (Qdll_error, "Invalid dynamic module: Missing symbol `emodule_name'", Qunbound);
 
-  mname = (char *)ALLOCA (strlen (*f) + 1);
+  mname = (CIbyte *) ALLOCA (strlen (*f) + 1);
   strcpy (mname, *f);
   if (mname[0] == '\0')
     signal_error (Qdll_error, "Invalid dynamic module: Empty value for `emodule_name'", Qunbound);
 
-  f = (const char **)dll_variable (dlhandle, "emodule_version");
-  if ((f == (const char **)0) || (*f == (const char *)0))
+  f = (const CIbyte **) dll_variable (dlhandle, "emodule_version");
+  if (f == NULL || *f == NULL)
     signal_error (Qdll_error, "Missing symbol `emodule_version': Invalid dynamic module", Qunbound);
 
-  mver = (char *)ALLOCA (strlen (*f) + 1);
+  mver = (CIbyte *) ALLOCA (strlen (*f) + 1);
   strcpy (mver, *f);
 
-  f = (const char **)dll_variable (dlhandle, "emodule_title");
-  if ((f == (const char **)0) || (*f == (const char *)0))
+  f = (const CIbyte **) dll_variable (dlhandle, "emodule_title");
+  if (f == NULL || *f == NULL)
     signal_error (Qdll_error, "Invalid dynamic module: Missing symbol `emodule_title'", Qunbound);
 
-  mtitle = (char *)ALLOCA (strlen (*f) + 1);
+  mtitle = (CIbyte *) ALLOCA (strlen (*f) + 1);
   strcpy (mtitle, *f);
 
-  symname = (char *)ALLOCA (strlen (mname) + 15);
+  symname = (CIbyte *) ALLOCA (strlen (mname) + 15);
 
   strcpy (symname, "modules_of_");
   strcat (symname, mname);
@@ -414,7 +412,7 @@
   strcpy (symname, "syms_of_");
   strcat (symname, mname);
   modsyms = (void (*)(void))dll_function (dlhandle, symname);
-  if (modsyms == (void (*)(void))0)
+  if (modsyms == NULL)
     {
     missing_symbol:
       signal_error (Qdll_error, "Invalid dynamic module: Missing symbol",
@@ -424,13 +422,13 @@
   strcpy (symname, "vars_of_");
   strcat (symname, mname);
   modvars = (void (*)(void))dll_function (dlhandle, symname);
-  if (modvars == (void (*)(void))0)
+  if (modvars == NULL)
     goto missing_symbol;
 
   strcpy (symname, "docs_of_");
   strcat (symname, mname);
   moddocs = (void (*)(void))dll_function (dlhandle, symname);
-  if (moddocs == (void (*)(void))0)
+  if (moddocs == NULL)
     goto missing_symbol;
 
   /* Now look for the optional unload function. */
@@ -574,7 +572,7 @@
 reinit_vars_of_module (void)
 {
   emodules_depth = 0;
-  modules = (emodules_list *)0;
+  modules = NULL;
   modnum = 0;
 }
 
--- a/src/lisp.h	Sun Sep 21 21:52:23 2003 +0000
+++ b/src/lisp.h	Mon Sep 22 03:21:19 2003 +0000
@@ -3901,18 +3901,18 @@
 #endif
 
 /* Defined in eval.c */
-EXFUN (Fapply, MANY);
+MODULE_API EXFUN (Fapply, MANY);
 EXFUN (Fbacktrace, 2);
 EXFUN (Fcommand_execute, 3);
 EXFUN (Fcommandp, 1);
-EXFUN (Feval, 1);
-EXFUN (Ffuncall, MANY);
+MODULE_API EXFUN (Feval, 1);
+MODULE_API EXFUN (Ffuncall, MANY);
 EXFUN (Ffunctionp, 1);
 EXFUN (Finteractive_p, 0);
 EXFUN (Fprogn, UNEVALLED);
-EXFUN (Fsignal, 2);
-EXFUN (Fthrow, 2);
-EXFUN (Fcall_with_condition_handler, MANY);
+MODULE_API EXFUN (Fsignal, 2);
+MODULE_API EXFUN (Fthrow, 2);
+MODULE_API EXFUN (Fcall_with_condition_handler, MANY);
 EXFUN (Ffunction_max_args, 1);
 EXFUN (Ffunction_min_args, 1);
 
@@ -4044,22 +4044,25 @@
 void va_run_hook_with_args (Lisp_Object, int, ...);
 void va_run_hook_with_args_in_buffer (struct buffer *, Lisp_Object, int, ...);
 Lisp_Object run_hook (Lisp_Object);
-Lisp_Object apply1 (Lisp_Object, Lisp_Object);
-Lisp_Object call0 (Lisp_Object);
-Lisp_Object call1 (Lisp_Object, Lisp_Object);
-Lisp_Object call2 (Lisp_Object, Lisp_Object, Lisp_Object);
-Lisp_Object call3 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
-Lisp_Object call4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
-		   Lisp_Object);
-Lisp_Object call5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
-		   Lisp_Object, Lisp_Object);
-Lisp_Object call6 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
-		   Lisp_Object, Lisp_Object, Lisp_Object);
-Lisp_Object call7 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
-		   Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
-Lisp_Object call8 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
-		   Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
-		   Lisp_Object);
+MODULE_API Lisp_Object apply1 (Lisp_Object, Lisp_Object);
+MODULE_API Lisp_Object call0 (Lisp_Object);
+MODULE_API Lisp_Object call1 (Lisp_Object, Lisp_Object);
+MODULE_API Lisp_Object call2 (Lisp_Object, Lisp_Object, Lisp_Object);
+MODULE_API Lisp_Object call3 (Lisp_Object, Lisp_Object, Lisp_Object,
+			      Lisp_Object);
+MODULE_API Lisp_Object call4 (Lisp_Object, Lisp_Object, Lisp_Object,
+			      Lisp_Object, Lisp_Object);
+MODULE_API Lisp_Object call5 (Lisp_Object, Lisp_Object, Lisp_Object,
+			      Lisp_Object, Lisp_Object, Lisp_Object);
+MODULE_API Lisp_Object call6 (Lisp_Object, Lisp_Object, Lisp_Object,
+			      Lisp_Object, Lisp_Object, Lisp_Object,
+			      Lisp_Object);
+MODULE_API Lisp_Object call7 (Lisp_Object, Lisp_Object, Lisp_Object,
+			      Lisp_Object, Lisp_Object, Lisp_Object,
+			      Lisp_Object, Lisp_Object);
+MODULE_API Lisp_Object call8 (Lisp_Object, Lisp_Object, Lisp_Object,
+			      Lisp_Object, Lisp_Object, Lisp_Object,
+			      Lisp_Object, Lisp_Object, Lisp_Object);
 Lisp_Object call0_in_buffer (struct buffer *, Lisp_Object);
 Lisp_Object call1_in_buffer (struct buffer *, Lisp_Object, Lisp_Object);
 Lisp_Object call2_in_buffer (struct buffer *, Lisp_Object, Lisp_Object,
--- a/src/objects-msw.c	Sun Sep 21 21:52:23 2003 +0000
+++ b/src/objects-msw.c	Mon Sep 22 03:21:19 2003 +0000
@@ -2185,7 +2185,7 @@
 
   /* If FONT specifies a particular charset, this will only list fonts with
      that charset; otherwise, it will list fonts with all charsets. */
-  fontlist = mswindows_list_fonts (font, device);
+  fontlist = mswindows_list_fonts (font, device, Qnil);
 
   if (!stage)
     {
--- a/src/symsinit.h	Sun Sep 21 21:52:23 2003 +0000
+++ b/src/symsinit.h	Mon Sep 22 03:21:19 2003 +0000
@@ -95,7 +95,7 @@
 void syms_of_doc (void);
 void syms_of_dragdrop (void);
 void syms_of_editfns (void);
-void syms_of_eldap (void);
+EXTERN_C void syms_of_eldap (void);
 void syms_of_elhash (void);
 void syms_of_emacs (void);
 void syms_of_eval (void);
@@ -155,7 +155,7 @@
 void syms_of_objects_mswindows (void);
 void syms_of_objects_tty (void);
 void syms_of_objects_x (void);
-void syms_of_postgresql (void);
+EXTERN_C void syms_of_postgresql (void);
 void syms_of_print (void);
 void syms_of_process (void);
 void syms_of_process_nt (void);
@@ -433,8 +433,8 @@
 void vars_of_win32 (void);
 void vars_of_select_x (void);
 void reinit_vars_of_select_x (void);
-void vars_of_eldap (void);
-void vars_of_postgresql (void);
+EXTERN_C void vars_of_eldap (void);
+EXTERN_C void vars_of_postgresql (void);
 void vars_of_gpmevent (void);
 
 /* Initialize specifier variables (dump-time only). */
--- a/src/sysdll.c	Sun Sep 21 21:52:23 2003 +0000
+++ b/src/sysdll.c	Mon Sep 22 03:21:19 2003 +0000
@@ -29,7 +29,7 @@
 
 #ifdef DLSYM_NEEDS_UNDERSCORE
 #define MAYBE_PREPEND_UNDERSCORE(n) do {		\
-  char *buf = alloca_array (char, strlen (n) + 2);	\
+  CIbyte *buf = alloca_array (CIbyte, strlen (n) + 2);	\
   *buf = '_';						\
   strcpy (buf + 1, n);					\
   n = buf;						\
@@ -63,15 +63,25 @@
 #endif
 
 int
-dll_init (const char *arg)
+dll_init (const Extbyte *arg)
 {
   return 0;
 }
 
 dll_handle
-dll_open (const char *fname)
+dll_open (Lisp_Object fname)
 {
-  return (dll_handle) dlopen (fname, RTLD_NOW);
+  Extbyte *soname;
+
+  if (NILP (fname))
+    {
+      soname = NULL;
+    }
+  else
+    {
+      LISP_STRING_TO_EXTERNAL (fname, soname, Qdll_filename_encoding);
+    }
+  return (dll_handle) dlopen (soname, RTLD_NOW);
 }
 
 int
@@ -81,47 +91,56 @@
 }
 
 dll_func
-dll_function (dll_handle h, const char *n)
+dll_function (dll_handle h, const CIbyte *n)
 {
   MAYBE_PREPEND_UNDERSCORE (n);
   return (dll_func) dlsym ((void *) h, n);
 }
 
 dll_var
-dll_variable (dll_handle h, const char *n)
+dll_variable (dll_handle h, const CIbyte *n)
 {
   MAYBE_PREPEND_UNDERSCORE (n);
   return (dll_var)dlsym ((void *)h, n);
 }
 
-const char *
+Lisp_Object
 dll_error (dll_handle h)
 {
+  const Extbyte *msg;
 #if defined(HAVE_DLERROR) || defined(dlerror)
-  return (const char *) dlerror ();
+  msg = (const Extbyte *) dlerror ();
 #elif defined(HAVE__DLERROR)
-  return (const char *) _dlerror();
+  msg = (const Extbyte *) _dlerror();
 #else
-  return "Shared library error";
+  msg = (const Extbyte *) "Shared library error";
 #endif
+  return build_ext_string (msg, Qnative);
 }
 
 #elif defined(HAVE_SHL_LOAD)
 /* This is the HP/UX version */
 #include <dl.h>
 int
-dll_init (const char *arg)
+dll_init (const Extbyte *arg)
 {
   return 0;
 }
 
 dll_handle
-dll_open (const char *fname)
+dll_open (Lisp_Object fname)
 {
-  /* shl_load will hang hard if passed a NULL fname. */
-  if (fname == NULL) return NULL;
+  Extbyte *soname;
 
-  return (dll_handle) shl_load (fname, BIND_DEFERRED, 0L);
+  if (NILP (fname))
+    {
+      soname = NULL;
+    }
+  else
+    {
+      LISP_STRING_TO_EXTERNAL (fname, soname, Qdll_filename_encoding);
+    }
+  return (dll_handle) shl_load (soname, BIND_DEFERRED, 0L);
 }
 
 int
@@ -131,7 +150,7 @@
 }
 
 dll_func
-dll_function (dll_handle h, const char *n)
+dll_function (dll_handle h, const CIbyte *n)
 {
   long handle = 0L;
 
@@ -142,7 +161,7 @@
 }
 
 dll_var
-dll_variable (dll_handle h, const char *n)
+dll_variable (dll_handle h, const CIbyte *n)
 {
   long handle = 0L;
 
@@ -152,109 +171,65 @@
   return (dll_var) handle;
 }
 
-const char *
+Lisp_Object
 dll_error (dll_handle h)
 {
   /* #### WTF?!  Shouldn't this at least attempt to get strerror or
      something?  --hniksic */
-  return "Generic shared library error";
-}
-
-#elif defined(HAVE_DLD_INIT)
-#include <dld.h>
-int
-dll_init (const char *arg)
-{
-  char *real_exe = dld_find_executable (arg);
-  int rc;
-
-  rc = dld_init (real_exe);
-  if (rc)
-    {
-      dld_perror (exe);
-      return -1;
-    }
-  return 0;
+  return build_string ("Generic shared library error", Qnative);
 }
 
-dll_handle
-dll_open (const char *fname)
-{
-  rc = dld_link (fname);
-  if (rc)
-    return NULL;
-
-  return (dll_handle) 1;
-}
-
-int
-dll_close (dll_handle h)
-{
-  /* *sigh* DLD is pretty lame and doesn't return a handle that you can use
-  ** later on to free the file - you have to remember the filename and
-  ** use that as the unlinker.  We should eventually keep a linked list
-  ** of loaded modules and then use the node pointer as the unique id
-  ** for the shared library.  Wheeee.  But not now.
-  */
-  return 1;
-}
-
-DLL_FUNC
-dll_function (dll_handle h, const char *n)
-{
-  return dld_get_func (n);
-}
-
-DLL_FUNC
-dll_variable (dll_handle h, const char *n)
-{
-  return dld_get_symbol (n);
-}
 #elif defined (WIN32_NATIVE) || defined (CYGWIN)
 
 #include "syswindows.h"
 #include "sysfile.h"
 
 int
-dll_init (const char *arg)
+dll_init (const Extbyte *arg)
 {
   return 0;
 }
 
 dll_handle
-dll_open (const char *fname)
+dll_open (Lisp_Object fname)
 {
-  Ibyte *winfname, *unifname;
-  LOCAL_TO_WIN32_FILE_FORMAT ((char *) fname, winfname);
-  C_STRING_TO_TSTR (winfname, unifname);
-  return (dll_handle) qxeLoadLibrary (unifname);
+  Extbyte *soname;
+
+  if (NILP (fname))
+    {
+      soname = NULL;
+    }
+  else
+    {
+      LOCAL_FILE_FORMAT_TO_TSTR (fname, soname);
+    }
+  return (dll_handle) qxeLoadLibrary (soname);
 }
 
 int
 dll_close (dll_handle h)
 {
-  return FreeLibrary (h);
+  return FreeLibrary ((HMODULE) h);
 }
 
 dll_func
-dll_function (dll_handle h, const char *n)
+dll_function (dll_handle h, const CIbyte *n)
 {
-  return (dll_func) GetProcAddress (h, n);
+  return (dll_func) GetProcAddress ((HINSTANCE) h, n);
 }
 
 dll_func
-dll_variable (dll_handle h, const char *n)
+dll_variable (dll_handle h, const CIbyte *n)
 {
-  return (dll_func) GetProcAddress (h, n);
+  return (dll_func) GetProcAddress ((HINSTANCE) h, n);
 }
 
-const char *
+Lisp_Object
 dll_error (dll_handle h)
 {
-  /* Since nobody frees the returned string, I have to make this ugly hack. */
-  static char err[32] = "Windows DLL Error ";
-  snprintf (&err[18], 14, "%lu", GetLastError ());
-  return err;
+  CIbyte err[32];
+  snprintf (err, 32, "Windows DLL Error %lu", GetLastError ());
+  return build_string (err);
 }
 #elif defined(HAVE_DYLD)
 /* This section supports MacOSX dynamic libraries. Dynamically
@@ -264,22 +239,32 @@
 #include <mach-o/dyld.h>
 
 int
-dll_init (const char *arg)
+dll_init (const Extbyte *arg)
 {
   return 0;
 }
 
 dll_handle
-dll_open (const char *fname)
+dll_open (Lisp_Object fname)
 {
+  Extbyte *soname;
   NSObjectFileImage file;
   NSModule out;
-  NSObjectFileImageReturnCode ret =
-    NSCreateObjectFileImageFromFile(fname, &file);
+  NSObjectFileImageReturnCode ret;
+
+  if (NILP (fname))
+    {
+      soname = NULL;
+    }
+  else
+    {
+      LISP_STRING_TO_EXTERNAL (fname, soname, Qdll_filename_encoding);
+    }
+  ret = NSCreateObjectFileImageFromFile(soname, &file);
   if (ret != NSObjectFileImageSuccess) {
     return NULL;
   }
-  out = NSLinkModule(file, fname,
+  out = NSLinkModule(file, soname,
 		     NSLINKMODULE_OPTION_BINDNOW |
 		     NSLINKMODULE_OPTION_PRIVATE |
 		     NSLINKMODULE_OPTION_RETURN_ON_ERROR);
@@ -293,7 +278,7 @@
 }
 
 dll_func
-dll_function (dll_handle h, const char *n)
+dll_function (dll_handle h, const CIbyte *n)
 {
   NSSymbol sym;
   MAYBE_PREPEND_UNDERSCORE (n);
@@ -303,7 +288,7 @@
 }
 
 dll_var
-dll_variable (dll_handle h, const char *n)
+dll_variable (dll_handle h, const CIbyte *n)
 {
   NSSymbol sym;
   MAYBE_PREPEND_UNDERSCORE (n);
@@ -312,25 +297,25 @@
   return (dll_var)NSAddressOfSymbol(sym);
 }
 
-const char *
+Lisp_Object
 dll_error (dll_handle h)
 {
   NSLinkEditErrors c;
   int errorNumber;
-  const char *fileNameWithError, *errorString;
+  const CIbyte *fileNameWithError, *errorString;
   NSLinkEditError(&c, &errorNumber, &fileNameWithError, &errorString);
-  return errorString;
+  return build_ext_string (errorString, Qnative);
 }
 #else
-/* Catchall if we don't know about this systems method of dynamic loading */
+/* Catchall if we don't know about this system's method of dynamic loading */
 int
-dll_init (const char *arg)
+dll_init (const Extbyte *arg)
 {
   return -1;
 }
 
 dll_handle
-dll_open (const char *fname)
+dll_open (Lisp_Object fname)
 {
   return NULL;
 }
@@ -342,21 +327,21 @@
 }
 
 dll_func
-dll_function (dll_handle h, const char *n)
+dll_function (dll_handle h, const CIbyte *n)
 {
   return NULL;
 }
 
 dll_func
-dll_variable (dll_handle h, const char *n)
+dll_variable (dll_handle h, const CIbyte *n)
 {
   return NULL;
 }
 
-const char *
+Lisp_Object
 dll_error (dll_handle h)
 {
-  return "Shared libraries not implemented on this system";
+  return build_string ("Shared libraries not implemented on this system");
 }
 #endif /* System conditionals */
 
--- a/src/sysdll.h	Sun Sep 21 21:52:23 2003 +0000
+++ b/src/sysdll.h	Mon Sep 22 03:21:19 2003 +0000
@@ -38,13 +38,13 @@
 typedef void * dll_func;
 typedef void * dll_var;
 
-int dll_init(const char *);
-int dll_shutdown(void);
-dll_handle dll_open(const char *);
-int dll_close(dll_handle);
-dll_func dll_function(dll_handle,const char *);
-dll_var dll_variable(dll_handle,const char *);
-const char *dll_error(dll_handle);
+extern int dll_init(const Extbyte *);
+extern int dll_shutdown(void);
+extern dll_handle dll_open(Lisp_Object);
+extern int dll_close(dll_handle);
+extern dll_func dll_function(dll_handle, const CIbyte *);
+extern dll_var dll_variable(dll_handle, const CIbyte *);
+extern Lisp_Object dll_error(dll_handle);
 
 #ifdef __cplusplus
 }
--- a/src/xemacs.def.in.in	Sun Sep 21 21:52:23 2003 +0000
+++ b/src/xemacs.def.in.in	Mon Sep 22 03:21:19 2003 +0000
@@ -10,6 +10,7 @@
 /* Exported functions */
 acons
 alloc_automanaged_lcrecord	/* alloc_lcrecord_type */
+apply1
 #ifdef USE_ASSERTIONS
 assert_failed			/* abort(), assert(), etc. */
 #endif
@@ -20,6 +21,17 @@
 build_string
 #ifdef MULE
 bytecount_to_charcount_fun	/* bytecount_to_charcount */
+#endif
+call0
+call1
+call2
+call3
+call4
+call5
+call6
+call7
+call8
+#ifdef MULE
 charcount_to_bytecount_fun	/* charcount_to_bytecount */
 #endif
 check_quit			/* QUITP */
@@ -137,12 +149,16 @@
 Dynarr_newf			/* Dynarr_new, Dynarr_new2 */
 Dynarr_resize			/* Dynarr_add */
 Fappend
+Fapply
 Fbuffer_modified_p
 Fbuffer_name
+Fcall_with_condition_handler
 Fcons
 Fcurrent_buffer
 Fequal
+Feval
 Fexpand_abbrev
+Ffuncall
 Fget
 Fkill_buffer
 Flength
@@ -156,6 +172,8 @@
 Fput
 Freverse
 Fset_buffer
+Fsignal
+Fthrow
 Fvector
 
 /* Exported variables */