changeset 1632:64eaceca611d

[xemacs-hg @ 2003-08-19 02:07:03 by james] Enable module building and running on Cygwin and MinGW.
author james
date Tue, 19 Aug 2003 02:07:16 +0000
parents 1bf7b032a45d
children baca156a450b
files modules/ChangeLog modules/common/Makefile.common modules/ldap/eldap.c modules/postgresql/postgresql.c src/ChangeLog src/Makefile.in.in src/emodules.c src/emodules.h src/general-slots.h src/general.c src/lisp-union.h src/lisp.h src/lrecord.h src/mem-limits.h src/opaque.h src/process.h src/symeval.h src/sysdll.c src/text.h src/xemacs.def.in.in
diffstat 20 files changed, 524 insertions(+), 209 deletions(-) [+]
line wrap: on
line diff
--- a/modules/ChangeLog	Mon Aug 18 21:52:34 2003 +0000
+++ b/modules/ChangeLog	Tue Aug 19 02:07:16 2003 +0000
@@ -1,3 +1,11 @@
+2003-08-18  Jerry James  <james@xemacs.org>
+
+	* postgresql/postgresql.c: Include emodules.h when building a module.
+	* ldap/eldap.c: Ditto.
+	* common/Makefile.common: Make module makefiles processable by cpp.
+	* common/Makefile.common (IMPORT_LIB): New.
+	* common/Makefile.common: Use it.
+
 2003-06-11  Jerry James  <james@xemacs.org>
 
 	* common/Makefile.common: The last change re-broke FreeBSD module
--- a/modules/common/Makefile.common	Mon Aug 18 21:52:34 2003 +0000
+++ b/modules/common/Makefile.common	Tue Aug 19 02:07:16 2003 +0000
@@ -27,6 +27,9 @@
 
 ## Note: This will be appended to the individual module Makefiles by configure.
 
+#define NOT_C_CODE
+#include "../../src/config.h"
+
 SHELL=/bin/sh
 RM=rm -f
 PROGNAME=@PROGNAME@
@@ -54,6 +57,9 @@
 INSTALLPATH=@INSTALLPATH@
 INSTALL_PROGRAM=@MOD_INSTALL_PROGRAM@
 OBJECT_TO_BUILD=@OBJECT_TO_BUILD@
+#ifdef HAVE_MS_WINDOWS
+IMPORT_LIB=../../src/xemacs-import.a
+#endif
 
 .PHONY:	clean distclean install
 all: $(OBJECT_TO_BUILD)
@@ -61,9 +67,9 @@
 .c.o:
 	$(MODCC) $(MODCFLAGS) -c $<
 
-$(MODNAME).ell: $(OBJS) $(MODNAME)_i.o
+$(MODNAME).ell: $(OBJS) $(MODNAME)_i.o $(IMPORT_LIB)
 	$(MODCC) --mode=link --mode=verbose --mod-output=$@ \
-	$(OBJS) $(MODNAME)_i.o $(LDFLAGS)
+	$(OBJS) $(MODNAME)_i.o $(IMPORT_LIB) $(LDFLAGS)
 
 $(MODNAME)_i.c: $(SRCS)
 	ELLMAKEDOC=$(MAKE_DOCFILE) $(MODCC) --mode=init --mod-output=$@ \
--- a/modules/ldap/eldap.c	Mon Aug 18 21:52:34 2003 +0000
+++ b/modules/ldap/eldap.c	Tue Aug 19 02:07:16 2003 +0000
@@ -36,6 +36,9 @@
 #include "sysdep.h"
 #include "buffer.h"
 #include "process.h"		/* for report_process_error */
+#ifdef HAVE_SHLIB
+# include "emodules.h"
+#endif
 
 #include <errno.h>
 
--- a/modules/postgresql/postgresql.c	Mon Aug 18 21:52:34 2003 +0000
+++ b/modules/postgresql/postgresql.c	Tue Aug 19 02:07:16 2003 +0000
@@ -102,6 +102,9 @@
 #include "buffer.h"
 #include "postgresql.h"
 #include "process.h"
+#ifdef HAVE_SHLIB
+# include "emodules.h"
+#endif
 
 #ifdef RUNNING_XEMACS_21_1 /* handle interface changes */
 #define PG_OS_CODING FORMAT_FILENAME
--- a/src/ChangeLog	Mon Aug 18 21:52:34 2003 +0000
+++ b/src/ChangeLog	Tue Aug 19 02:07:16 2003 +0000
@@ -1,3 +1,30 @@
+2003-08-18  Jerry James  <james@xemacs.org>
+
+	* Makefile.in.in (export_lib): New.
+	* Makefile.in.in (xemacs-export.o): New.
+	* Makefile.in.in (otherobjs): Use them.
+	* emodules.c: Remove the EMODULES_DO_NOT_REDEFINE hack.
+	* emodules.c (Fload_module): Document the ".dylib" extension.
+	* emodules.c (emodules_doc_subr): Don't try to find the function
+	associated with an autoload cookie.
+	* emodules.h: Add MODULE_API markers.  Other part of
+	EMODULES_DO_NOT_REDEFINE hack removal.  Define unstaticpro to
+	unstaticpro_nodump for modules.
+	* general-slots.h: Document and use SYMBOL_MODULE_API.
+	* general.c (SYMBOL_MODULE_API): New.
+	* lisp.h: Ditto.  Also define MODULE_API appropriately, and define
+	SYMBOL_MODULE_API.
+	* sysdll.c: Allow Cygin module building.
+	* sysdll.c (dll_open): Use Unicode module names correctly.
+	* sysdll.c (dll_error): Return an informative error message.
+	* lisp-union.h: Add MODULE_API markers.
+	* lrecord.h: Ditto.
+	* mem-limits.h (get_lim_data): Ditto.
+	* opaque.h: Ditto.
+	* process.h: Ditto.
+	* symeval.h: Ditto.
+	* text.h: Ditto.
+
 2003-08-18  Jerry James  <james@xemacs.org>
 
 	* bytecode.c (execute_optimized_program): Setting a buffer-local
--- a/src/Makefile.in.in	Mon Aug 18 21:52:34 2003 +0000
+++ b/src/Makefile.in.in	Tue Aug 19 02:07:16 2003 +0000
@@ -224,6 +224,11 @@
 
 #ifdef HAVE_SHLIB
 shlib_objs=sysdll.o emodules.o
+# ifdef HAVE_MS_WINDOWS
+export_lib=xemacs-export.o
+xemacs-export.o: xemacs.def
+	dlltool -D xemacs-${version}.exe -d $< -l xemacs-import.a -e $@
+# endif
 #endif
 
 #ifdef SUNPRO
@@ -342,7 +347,7 @@
 
 ## define otherobjs as list of object files that make-docfile
 ## should not be told about.
-otherobjs = lastfile.o $(mallocobjs) $(rallocobjs) $(X11_objs)
+otherobjs = lastfile.o $(mallocobjs) $(rallocobjs) $(X11_objs) $(export_lib)
 otherrtls = $(otherobjs:.o=.c.rtl)
 othersrcs = $(otherobjs:.o=.c)
 
--- a/src/emodules.c	Mon Aug 18 21:52:34 2003 +0000
+++ b/src/emodules.c	Tue Aug 19 02:07:16 2003 +0000
@@ -18,10 +18,6 @@
 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
-/* This gross hack is so that we can make DEFVAR_foo register with the
-   portable dumper in core, but not do so in modules.  Since the hackery to do
-   that is in emodules.h, we have to turn it off for this file. */
-#define EMODULES_DO_NOT_REDEFINE
 #include "emodules.h"
 #include "sysdll.h"
 
@@ -78,7 +74,7 @@
 loaded if it matches that VERSION.  This function will check to make
 sure that the same module is not loaded twice.  Modules are searched
 for in the same way as Lisp files, except that the valid file
-extensions are `.so', `.dll' or `.ell'.
+extensions are `.so', `.dll', `.ell', or `.dylib'.
 
 All symbols in the shared module must be completely resolved in order
 for this function to be successful.  Any modules which the specified
@@ -528,9 +524,10 @@
   Lisp_Object sym = oblookup (Vobarray, (const Ibyte *)symname, len);
   Lisp_Subr *subr;
 
-  if (SYMBOLP(sym))
+  /* Skip autoload cookies */
+  if (SYMBOLP (sym) && SUBRP (XSYMBOL (sym)->function))
     {
-      subr = XSUBR( XSYMBOL(sym)->function);
+      subr = XSUBR (XSYMBOL (sym)->function);
       subr->doc = xstrdup (doc);
     }
   /*
--- a/src/emodules.h	Mon Aug 18 21:52:34 2003 +0000
+++ b/src/emodules.h	Tue Aug 19 02:07:16 2003 +0000
@@ -73,15 +73,17 @@
  * into the right place. These functions will be called by the module
  * init code, generated by ellcc during initialization mode.
  */
-extern void emodules_doc_subr (const char *objname, const char *docstr);
-extern void emodules_doc_sym (const char *objname, const char *docstr);
+extern MODULE_API void emodules_doc_subr (const char *objname,
+					  const char *docstr);
+extern MODULE_API void emodules_doc_sym (const char *objname,
+					 const char *docstr);
 
 #define CDOCSUBR(Fname, DOC) emodules_doc_subr (Fname, DOC)
 #define CDOCSYM(Sname, DOC)  emodules_doc_sym  (Sname, DOC)
 #endif /* EMODULES_GATHER_VERSION */
 
 /* We should not expose module entities to the portable dumper. */
-#if defined(PDUMP) && !defined(EMODULES_DO_NOT_REDEFINE)
+#if defined(PDUMP) && defined(EMACS_MODULE)
 #undef dump_add_root_struct_ptr
 #define dump_add_root_struct_ptr(varaddr,descaddr) DO_NOTHING
 #undef dump_add_opaque
@@ -98,6 +100,8 @@
 #define dump_add_weak_object_chain(varaddr) DO_NOTHING
 #undef staticpro
 #define staticpro(DSF_location) staticpro_nodump(DSF_location)
+#undef unstaticpro
+#define unstaticpro(DSF_location) unstaticpro_nodump(DFS_location)
 
 #undef DEFSYMBOL
 #define DEFSYMBOL(name) DEFSYMBOL_NO_DUMP (name)
@@ -106,6 +110,7 @@
         DEFSYMBOL_MULTIWORD_PREDICATE_NO_DUMP (name)
 #undef defsymbol
 #define defsymbol(location,name) defsymbol_nodump (location, name)
-#endif
+
+#endif /* defined(PDUMP) && defined(EMACS_MODULE) */
 
 #endif /* EMODULES_HDR */
--- a/src/general-slots.h	Mon Aug 18 21:52:34 2003 +0000
+++ b/src/general-slots.h	Tue Aug 19 02:07:16 2003 +0000
@@ -25,9 +25,10 @@
    that don't have any obvious connection to any particular module
    and might be used in many different contexts.
 
-   Three types of declarations are allowed here:
+   Four types of declarations are allowed here:
 
    SYMBOL (Qfoo); declares a symbol "foo"
+   SYMBOL_MODULE_API (Qfoo); declares a symbol "foo" that is visible to modules
    SYMBOL_KEYWORD (Q_foo); declares a keyword symbol ":foo"
    SYMBOL_GENERAL (Qfoo, "bar"); declares a symbol named "bar" but stored in
      the variable Qfoo
@@ -124,7 +125,7 @@
 SYMBOL (Qfaces);
 SYMBOL (Qfallback);
 SYMBOL (Qfile);
-SYMBOL (Qfile_name);
+SYMBOL_MODULE_API (Qfile_name);
 SYMBOL_KEYWORD (Q_filter);
 SYMBOL (Qfont);
 SYMBOL (Qframe);
@@ -194,13 +195,13 @@
 SYMBOL (Qmsprinter);
 SYMBOL (Qmswindows);
 SYMBOL (Qname);
-SYMBOL (Qnative);
+SYMBOL_MODULE_API (Qnative);
 SYMBOL (Qnatnum);
 SYMBOL (Qno);
 SYMBOL (Qnone);
 SYMBOL (Qnot);
 SYMBOL (Qnothing);
-SYMBOL (Qnotice);
+SYMBOL_MODULE_API (Qnotice);
 SYMBOL (Qobject);
 SYMBOL (Qok);
 SYMBOL (Qold_assoc);
--- a/src/general.c	Mon Aug 18 21:52:34 2003 +0000
+++ b/src/general.c	Tue Aug 19 02:07:16 2003 +0000
@@ -28,12 +28,14 @@
 #include "lisp.h"
 
 #define SYMBOL(fou) Lisp_Object fou
+#define SYMBOL_MODULE_API(fou) Lisp_Object fou
 #define SYMBOL_KEYWORD(la_cle_est_fou) Lisp_Object la_cle_est_fou
 #define SYMBOL_GENERAL(tout_le_monde, est_fou) Lisp_Object tout_le_monde
 
 #include "general-slots.h"
 
 #undef SYMBOL
+#undef SYMBOL_MODULE_API
 #undef SYMBOL_KEYWORD
 #undef SYMBOL_GENERAL
 
@@ -41,6 +43,7 @@
 syms_of_general (void)
 {
 #define SYMBOL(loco) DEFSYMBOL (loco)
+#define SYMBOL_MODULE_API(loco) DEFSYMBOL (loco)
 #define SYMBOL_KEYWORD(meshugeneh) DEFKEYWORD (meshugeneh)
 #define SYMBOL_GENERAL(vachement, fou) defsymbol (&vachement, fou)
 
--- a/src/lisp-union.h	Mon Aug 18 21:52:34 2003 +0000
+++ b/src/lisp-union.h	Tue Aug 19 02:07:16 2003 +0000
@@ -132,7 +132,7 @@
   return obj;
 }
 
-extern Lisp_Object Qnull_pointer, Qzero;
+extern MODULE_API Lisp_Object Qnull_pointer, Qzero;
 
 #define INTP(x) ((x).s.bits)
 #define INT_PLUS(x,y)  make_int (XINT (x) + XINT (y))
--- a/src/lisp.h	Mon Aug 18 21:52:34 2003 +0000
+++ b/src/lisp.h	Tue Aug 19 02:07:16 2003 +0000
@@ -928,6 +928,16 @@
 /*#define REGISTER register*/
 /*#endif*/
 
+#if defined(HAVE_MS_WINDOWS) && defined(HAVE_SHLIB)
+# ifdef EMACS_MODULE
+#  define MODULE_API __declspec(dllimport)
+# else
+#  define MODULE_API __declspec(dllexport)
+# endif
+#else
+# define MODULE_API
+#endif
+
 /* ------------------------ alignment definitions ------------------- */
 
 /* No type has a greater alignment requirement than max_align_t.
@@ -1012,7 +1022,7 @@
 #ifdef USE_ASSERTIONS
 /* Highly dubious kludge */
 /*   (thanks, Jamie, I feel better now -- ben) */
-void assert_failed (const char *, int, const char *);
+MODULE_API void assert_failed (const char *, int, const char *);
 # define abort() (assert_failed (__FILE__, __LINE__, "abort()"))
 # define assert(x) ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, #x))
 # define assert_with_message(x, msg) \
@@ -1073,10 +1083,10 @@
 
 /* Memory allocation */
 void malloc_warning (const char *);
-void *xmalloc (Bytecount size);
-void *xmalloc_and_zero (Bytecount size);
-void *xrealloc (void *, Bytecount size);
-char *xstrdup (const char *);
+MODULE_API void *xmalloc (Bytecount size);
+MODULE_API void *xmalloc_and_zero (Bytecount size);
+MODULE_API void *xrealloc (void *, Bytecount size);
+MODULE_API char *xstrdup (const char *);
 /* generally useful */
 #define countof(x) ((int) (sizeof(x)/sizeof((x)[0])))
 #define xnew(type) ((type *) xmalloc (sizeof (type)))
@@ -1088,9 +1098,9 @@
 #define alloca_new(type) ((type *) ALLOCA (sizeof (type)))
 #define alloca_array(type, len) ((type *) ALLOCA ((len) * sizeof (type)))
 
-void *xemacs_c_alloca (unsigned int size);
-
-int record_unwind_protect_freeing (void *ptr);
+MODULE_API void *xemacs_c_alloca (unsigned int size);
+
+MODULE_API int record_unwind_protect_freeing (void *ptr);
 
 DECLARE_INLINE_HEADER (
 void *
@@ -1144,11 +1154,11 @@
 
 #define MAX_FUNCALLS_BETWEEN_ALLOCA_CLEANUP 10
 
-extern Bytecount __temp_alloca_size__;
+extern MODULE_API Bytecount __temp_alloca_size__;
 extern Bytecount funcall_alloca_count;
 
 #ifdef ERROR_CHECK_MALLOC
-extern int regex_malloc_disallowed;
+extern MODULE_API int regex_malloc_disallowed;
 #define REGEX_MALLOC_CHECK() assert (!regex_malloc_disallowed)
 #else
 #define REGEX_MALLOC_CHECK() ((void) 0)
@@ -1210,7 +1220,7 @@
 } while (0)
 
 #ifdef ERROR_CHECK_MALLOC
-void xfree_1 (void *);
+MODULE_API void xfree_1 (void *);
 #define xfree(lvalue) do			\
 {						\
   void **xfree_ptr = (void **) &(lvalue);	\
@@ -1218,7 +1228,7 @@
   *xfree_ptr = (void *) 0xDEADBEEF;		\
 } while (0)
 #else
-void xfree (void *);
+MODULE_API void xfree (void *);
 #endif /* ERROR_CHECK_MALLOC */
 
 /* ------------------------ dynamic arrays ------------------- */
@@ -1245,11 +1255,11 @@
   Dynarr_declare (void);
 } Dynarr;
 
-void *Dynarr_newf (int elsize);
-void Dynarr_resize (void *dy, int size);
-void Dynarr_insert_many (void *d, const void *el, int len, int start);
-void Dynarr_delete_many (void *d, int start, int len);
-void Dynarr_free (void *d);
+MODULE_API void *Dynarr_newf (int elsize);
+MODULE_API void Dynarr_resize (void *dy, int size);
+MODULE_API void Dynarr_insert_many (void *d, const void *el, int len, int start);
+MODULE_API void Dynarr_delete_many (void *d, int start, int len);
+MODULE_API void Dynarr_free (void *d);
 
 #define Dynarr_new(type) ((type##_dynarr *) Dynarr_newf (sizeof (type)))
 #define Dynarr_new2(dynarr_type, type) \
@@ -1651,8 +1661,8 @@
 		       && XCHAR_OR_INT (obj1) == XCHAR_OR_INT (obj2)))
 
 #ifdef DEBUG_XEMACS
-extern int debug_issue_ebola_notices;
-int eq_with_ebola_notice (Lisp_Object, Lisp_Object);
+extern MODULE_API int debug_issue_ebola_notices;
+MODULE_API int eq_with_ebola_notice (Lisp_Object, Lisp_Object);
 #define EQ_WITH_EBOLA_NOTICE(obj1, obj2)				\
   (debug_issue_ebola_notices ? eq_with_ebola_notice (obj1, obj2)	\
    : EQ (obj1, obj2))
@@ -1708,7 +1718,7 @@
 };
 #endif
 
-DECLARE_LRECORD (cons, Lisp_Cons);
+DECLARE_MODULE_API_LRECORD (cons, Lisp_Cons);
 #define XCONS(x) XRECORD (x, cons, Lisp_Cons)
 #define wrap_cons(p) wrap_record (p, cons)
 #define CONSP(x) RECORDP (x, cons)
@@ -1718,7 +1728,7 @@
 #define CONS_MARKED_P(c) MARKED_RECORD_HEADER_P(&((c)->lheader))
 #define MARK_CONS(c) MARK_RECORD_HEADER (&((c)->lheader))
 
-extern Lisp_Object Qnil;
+extern MODULE_API Lisp_Object Qnil;
 
 #define NILP(x)  EQ (x, Qnil)
 #define cons_car(a) ((a)->car_)
@@ -2264,7 +2274,7 @@
 
 #define MAX_STRING_ASCII_BEGIN ((1 << 21) - 1)
 
-DECLARE_LRECORD (string, Lisp_String);
+DECLARE_MODULE_API_LRECORD (string, Lisp_String);
 #define XSTRING(x) XRECORD (x, string, Lisp_String)
 #define wrap_string(p) wrap_record (p, string)
 #define STRINGP(x) RECORDP (x, string)
@@ -2430,7 +2440,7 @@
 			 XSTRING_LENGTH (symbol_name (XSYMBOL (sym))))))
 #define KEYWORDP(obj) (SYMBOLP (obj) && SYMBOL_IS_KEYWORD (obj))
 
-DECLARE_LRECORD (symbol, Lisp_Symbol);
+DECLARE_MODULE_API_LRECORD (symbol, Lisp_Symbol);
 #define XSYMBOL(x) XRECORD (x, symbol, Lisp_Symbol)
 #define wrap_symbol(p) wrap_record (p, symbol)
 #define SYMBOLP(x) RECORDP (x, symbol)
@@ -2494,7 +2504,7 @@
   char insertion_type;
 };
 
-DECLARE_LRECORD (marker, Lisp_Marker);
+DECLARE_MODULE_API_LRECORD (marker, Lisp_Marker);
 #define XMARKER(x) XRECORD (x, marker, Lisp_Marker)
 #define wrap_marker(p) wrap_record (p, marker)
 #define MARKERP(x) RECORDP (x, marker)
@@ -2953,7 +2963,7 @@
 
    specpdl_depth is the current depth of `specpdl'.
    Save this for use later as arg to `unbind_to_1'.  */
-extern int specpdl_depth_counter;
+extern MODULE_API int specpdl_depth_counter;
 #define specpdl_depth() specpdl_depth_counter
 
 
@@ -2985,15 +2995,15 @@
    within the QUIT macro.  At this point, we are guaranteed to not be in
    any sensitive code. */
 
-extern volatile int something_happened;
-extern int dont_check_for_quit;
-void check_what_happened (void);
-
-extern volatile int quit_check_signal_happened;
+extern MODULE_API volatile int something_happened;
+extern MODULE_API int dont_check_for_quit;
+MODULE_API void check_what_happened (void);
+
+extern MODULE_API volatile int quit_check_signal_happened;
 extern volatile int quit_check_signal_tick_count;
-void check_quit (void);
-
-void signal_quit (void);
+MODULE_API void check_quit (void);
+
+MODULE_API void signal_quit (void);
 
 int begin_dont_check_for_quit (void);
 int begin_do_check_for_quit (void);
@@ -3126,7 +3136,7 @@
    Every function that can call Feval must protect in this fashion all
    Lisp_Object variables whose contents will be used again. */
 
-extern struct gcpro *gcprolist;
+extern MODULE_API struct gcpro *gcprolist;
 
 /* #### Catching insufficient gcpro:
 
@@ -3196,18 +3206,20 @@
 
 #ifdef DEBUG_GCPRO
 
-void debug_gcpro1 (char *, int, struct gcpro *, Lisp_Object *);
-void debug_gcpro2 (char *, int, struct gcpro *, struct gcpro *,
-		   Lisp_Object *, Lisp_Object *);
-void debug_gcpro3 (char *, int, struct gcpro *, struct gcpro *, struct gcpro *,
-		   Lisp_Object *, Lisp_Object *, Lisp_Object *);
-void debug_gcpro4 (char *, int, struct gcpro *, struct gcpro *, struct gcpro *,
-		   struct gcpro *, Lisp_Object *, Lisp_Object *, Lisp_Object *,
-		   Lisp_Object *);
-void debug_gcpro5 (char *, int, struct gcpro *, struct gcpro *, struct gcpro *,
-		   struct gcpro *, struct gcpro *, Lisp_Object *, Lisp_Object *,
-		   Lisp_Object *, Lisp_Object *, Lisp_Object *);
-void debug_ungcpro(char *, int, struct gcpro *);
+MODULE_API void debug_gcpro1 (char *, int, struct gcpro *, Lisp_Object *);
+MODULE_API void debug_gcpro2 (char *, int, struct gcpro *, struct gcpro *,
+			      Lisp_Object *, Lisp_Object *);
+MODULE_API void debug_gcpro3 (char *, int, struct gcpro *, struct gcpro *,
+			      struct gcpro *, Lisp_Object *, Lisp_Object *,
+			      Lisp_Object *);
+MODULE_API void debug_gcpro4 (char *, int, struct gcpro *, struct gcpro *,
+			      struct gcpro *, struct gcpro *, Lisp_Object *,
+			      Lisp_Object *, Lisp_Object *, Lisp_Object *);
+MODULE_API void debug_gcpro5 (char *, int, struct gcpro *, struct gcpro *,
+			      struct gcpro *, struct gcpro *, struct gcpro *,
+			      Lisp_Object *, Lisp_Object *, Lisp_Object *,
+			      Lisp_Object *, Lisp_Object *);
+MODULE_API void debug_ungcpro(char *, int, struct gcpro *);
 
 #define GCPRO1(v) \
  debug_gcpro1 (__FILE__, __LINE__,&gcpro1,&v)
@@ -3457,28 +3469,28 @@
 
 /* Help debug crashes gc-marking a staticpro'ed object. */
 
-void staticpro_1 (Lisp_Object *, char *);
-void staticpro_nodump_1 (Lisp_Object *, char *);
+MODULE_API void staticpro_1 (Lisp_Object *, char *);
+MODULE_API void staticpro_nodump_1 (Lisp_Object *, char *);
 #define staticpro(ptr) staticpro_1 (ptr, #ptr)
 #define staticpro_nodump(ptr) staticpro_nodump_1 (ptr, #ptr)
 
 #ifdef HAVE_SHLIB
-void unstaticpro_nodump_1 (Lisp_Object *, char *);
+MODULE_API void unstaticpro_nodump_1 (Lisp_Object *, char *);
 #define unstaticpro_nodump(ptr) unstaticpro_nodump_1 (ptr, #ptr)
 #endif
 
 #else
 
 /* Call staticpro (&var) to protect static variable `var'. */
-void staticpro (Lisp_Object *);
+MODULE_API void staticpro (Lisp_Object *);
 
 /* Call staticpro_nodump (&var) to protect static variable `var'. */
 /* var will not be saved at dump time */
-void staticpro_nodump (Lisp_Object *);
+MODULE_API void staticpro_nodump (Lisp_Object *);
 
 #ifdef HAVE_SHLIB
 /* Call unstaticpro_nodump (&var) to stop protecting static variable `var'. */
-void unstaticpro_nodump (Lisp_Object *);
+MODULE_API void unstaticpro_nodump (Lisp_Object *);
 #endif
 
 #endif
@@ -3512,55 +3524,56 @@
 #include "symsinit.h"
 
 /* Defined in abbrev.c */
-EXFUN (Fexpand_abbrev, 0);
+MODULE_API EXFUN (Fexpand_abbrev, 0);
 
 /* Defined in alloc.c */
-EXFUN (Fcons, 2);
-EXFUN (Flist, MANY);
+MODULE_API EXFUN (Fcons, 2);
+MODULE_API EXFUN (Flist, MANY);
 EXFUN (Fmake_byte_code, MANY);
-EXFUN (Fmake_list, 2);
-EXFUN (Fmake_string, 2);
-EXFUN (Fmake_symbol, 1);
-EXFUN (Fmake_vector, 2);
-EXFUN (Fvector, MANY);
+MODULE_API EXFUN (Fmake_list, 2);
+MODULE_API EXFUN (Fmake_string, 2);
+MODULE_API EXFUN (Fmake_symbol, 1);
+MODULE_API EXFUN (Fmake_vector, 2);
+MODULE_API EXFUN (Fvector, MANY);
 
 void release_breathing_space (void);
 Lisp_Object noseeum_cons (Lisp_Object, Lisp_Object);
-Lisp_Object make_vector (Elemcount, Lisp_Object);
-Lisp_Object vector1 (Lisp_Object);
-Lisp_Object vector2 (Lisp_Object, Lisp_Object);
-Lisp_Object vector3 (Lisp_Object, Lisp_Object, Lisp_Object);
+MODULE_API Lisp_Object make_vector (Elemcount, Lisp_Object);
+MODULE_API Lisp_Object vector1 (Lisp_Object);
+MODULE_API Lisp_Object vector2 (Lisp_Object, Lisp_Object);
+MODULE_API Lisp_Object vector3 (Lisp_Object, Lisp_Object, Lisp_Object);
 Lisp_Object make_bit_vector (Elemcount, Lisp_Object);
 Lisp_Object make_bit_vector_from_byte_vector (unsigned char *, Elemcount);
 Lisp_Object noseeum_make_marker (void);
 void garbage_collect_1 (void);
-Lisp_Object acons (Lisp_Object, Lisp_Object, Lisp_Object);
-Lisp_Object cons3 (Lisp_Object, Lisp_Object, Lisp_Object);
-Lisp_Object list1 (Lisp_Object);
-Lisp_Object list2 (Lisp_Object, Lisp_Object);
-Lisp_Object list3 (Lisp_Object, Lisp_Object, Lisp_Object);
-Lisp_Object list4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
-Lisp_Object list5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
-		   Lisp_Object);
-Lisp_Object list6 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
-		   Lisp_Object, Lisp_Object);
+MODULE_API Lisp_Object acons (Lisp_Object, Lisp_Object, Lisp_Object);
+MODULE_API Lisp_Object cons3 (Lisp_Object, Lisp_Object, Lisp_Object);
+MODULE_API Lisp_Object list1 (Lisp_Object);
+MODULE_API Lisp_Object list2 (Lisp_Object, Lisp_Object);
+MODULE_API Lisp_Object list3 (Lisp_Object, Lisp_Object, Lisp_Object);
+MODULE_API Lisp_Object list4 (Lisp_Object, Lisp_Object, Lisp_Object,
+			      Lisp_Object);
+MODULE_API Lisp_Object list5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
+			      Lisp_Object);
+MODULE_API Lisp_Object list6 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
+			      Lisp_Object, Lisp_Object);
 DECLARE_DOESNT_RETURN (memory_full (void));
 void disksave_object_finalization (void);
 extern int purify_flag;
 extern EMACS_INT gc_generation_number[1];
 int c_readonly (Lisp_Object);
 int lisp_readonly (Lisp_Object);
-void copy_lisp_object (Lisp_Object dst, Lisp_Object src);
-Lisp_Object build_intstring (const Ibyte *);
-Lisp_Object build_string (const CIbyte *);
-Lisp_Object build_ext_string (const Extbyte *, Lisp_Object);
-Lisp_Object build_msg_intstring (const Ibyte *);
-Lisp_Object build_msg_string (const CIbyte *);
-Lisp_Object make_string (const Ibyte *, Bytecount);
-Lisp_Object make_ext_string (const Extbyte *, EMACS_INT, Lisp_Object);
+MODULE_API void copy_lisp_object (Lisp_Object dst, Lisp_Object src);
+MODULE_API Lisp_Object build_intstring (const Ibyte *);
+MODULE_API Lisp_Object build_string (const CIbyte *);
+MODULE_API Lisp_Object build_ext_string (const Extbyte *, Lisp_Object);
+MODULE_API Lisp_Object build_msg_intstring (const Ibyte *);
+MODULE_API Lisp_Object build_msg_string (const CIbyte *);
+MODULE_API Lisp_Object make_string (const Ibyte *, Bytecount);
+MODULE_API Lisp_Object make_ext_string (const Extbyte *, EMACS_INT, Lisp_Object);
 void init_string_ascii_begin (Lisp_Object string);
 Lisp_Object make_uninit_string (Bytecount);
-Lisp_Object make_float (double);
+MODULE_API Lisp_Object make_float (double);
 Lisp_Object make_string_nocopy (const Ibyte *, Bytecount);
 void free_cons (Lisp_Object);
 void free_list (Lisp_Object);
@@ -3574,7 +3587,7 @@
 int marked_p (Lisp_Object obj);
 extern int funcall_allocation_flag;
 extern int need_to_garbage_collect;
-extern int need_to_check_c_alloca;
+extern MODULE_API int need_to_check_c_alloca;
 extern int need_to_signal_post_gc;
 extern Lisp_Object Qpost_gc_hook, Qgarbage_collecting;
 void recompute_funcall_allocation_flag (void);
@@ -3628,17 +3641,17 @@
 extern void init_initial_directory (void);   /* initialize initial_directory */
 
 EXFUN (Fbuffer_disable_undo, 1);
-EXFUN (Fbuffer_modified_p, 1);
-EXFUN (Fbuffer_name, 1);
-EXFUN (Fcurrent_buffer, 0);
+MODULE_API EXFUN (Fbuffer_modified_p, 1);
+MODULE_API EXFUN (Fbuffer_name, 1);
+MODULE_API EXFUN (Fcurrent_buffer, 0);
 EXFUN (Ferase_buffer, 1);
 EXFUN (Fget_buffer, 1);
 EXFUN (Fget_buffer_create, 1);
 EXFUN (Fget_file_buffer, 1);
-EXFUN (Fkill_buffer, 1);
+MODULE_API EXFUN (Fkill_buffer, 1);
 EXFUN (Fother_buffer, 3);
 EXFUN (Frecord_buffer, 1);
-EXFUN (Fset_buffer, 1);
+MODULE_API EXFUN (Fset_buffer, 1);
 EXFUN (Fset_buffer_modified_p, 2);
 
 extern Lisp_Object QSscratch, Qafter_change_function, Qafter_change_functions;
@@ -3711,7 +3724,8 @@
 DECLARE_DOESNT_RETURN (args_out_of_range (Lisp_Object, Lisp_Object));
 DECLARE_DOESNT_RETURN (args_out_of_range_3 (Lisp_Object, Lisp_Object,
 					    Lisp_Object));
-Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object);
+MODULE_API Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object);
+MODULE_API
 DECLARE_DOESNT_RETURN (dead_wrong_type_argument (Lisp_Object, Lisp_Object));
 void check_int_range (EMACS_INT, EMACS_INT, EMACS_INT);
 
@@ -3867,15 +3881,15 @@
 EXFUN (Ffunction_max_args, 1);
 EXFUN (Ffunction_min_args, 1);
 
-DECLARE_DOESNT_RETURN (signal_error_1 (Lisp_Object, Lisp_Object));
+MODULE_API DECLARE_DOESNT_RETURN (signal_error_1 (Lisp_Object, Lisp_Object));
 void maybe_signal_error_1 (Lisp_Object, Lisp_Object, Lisp_Object,
 			   Error_Behavior);
 Lisp_Object maybe_signal_continuable_error_1 (Lisp_Object, Lisp_Object,
 					      Lisp_Object, Error_Behavior);
-DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (signal_ferror
-						  (Lisp_Object,
-						   const CIbyte *,
-						   ...), 2, 3);
+MODULE_API DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (signal_ferror
+							     (Lisp_Object,
+							      const CIbyte *,
+							      ...), 2, 3);
 void maybe_signal_ferror (Lisp_Object, Lisp_Object, Error_Behavior,
 			  const CIbyte *, ...) PRINTF_ARGS (4, 5);
 Lisp_Object signal_continuable_ferror (Lisp_Object, const CIbyte *, ...)
@@ -3940,20 +3954,20 @@
 				  Lisp_Object frob2));
 void maybe_sferror (const CIbyte *, Lisp_Object, Lisp_Object,
 		    Error_Behavior);
-DECLARE_DOESNT_RETURN (invalid_argument (const CIbyte *reason,
-					 Lisp_Object frob));
-DECLARE_DOESNT_RETURN (invalid_argument_2 (const CIbyte *reason,
-					   Lisp_Object frob1,
-					   Lisp_Object frob2));
+MODULE_API DECLARE_DOESNT_RETURN (invalid_argument (const CIbyte *reason,
+						    Lisp_Object frob));
+MODULE_API DECLARE_DOESNT_RETURN (invalid_argument_2 (const CIbyte *reason,
+						      Lisp_Object frob1,
+						      Lisp_Object frob2));
 void maybe_invalid_argument (const CIbyte *, Lisp_Object, Lisp_Object,
 			     Error_Behavior);
-DECLARE_DOESNT_RETURN (invalid_operation (const CIbyte *reason,
-					 Lisp_Object frob));
-DECLARE_DOESNT_RETURN (invalid_operation_2 (const CIbyte *reason,
-					   Lisp_Object frob1,
-					   Lisp_Object frob2));
-void maybe_invalid_operation (const CIbyte *, Lisp_Object, Lisp_Object,
-			     Error_Behavior);
+MODULE_API DECLARE_DOESNT_RETURN (invalid_operation (const CIbyte *reason,
+						     Lisp_Object frob));
+MODULE_API DECLARE_DOESNT_RETURN (invalid_operation_2 (const CIbyte *reason,
+						       Lisp_Object frob1,
+						       Lisp_Object frob2));
+MODULE_API void maybe_invalid_operation (const CIbyte *, Lisp_Object,
+					 Lisp_Object, Error_Behavior);
 DECLARE_DOESNT_RETURN (invalid_state (const CIbyte *reason,
 					 Lisp_Object frob));
 DECLARE_DOESNT_RETURN (invalid_state_2 (const CIbyte *reason,
@@ -3968,18 +3982,19 @@
 					   Lisp_Object frob2));
 void maybe_invalid_change (const CIbyte *, Lisp_Object, Lisp_Object,
 			   Error_Behavior);
-DECLARE_DOESNT_RETURN (invalid_constant (const CIbyte *reason,
-					 Lisp_Object frob));
+MODULE_API DECLARE_DOESNT_RETURN (invalid_constant (const CIbyte *reason,
+						    Lisp_Object frob));
 DECLARE_DOESNT_RETURN (invalid_constant_2 (const CIbyte *reason,
 					   Lisp_Object frob1,
 					   Lisp_Object frob2));
 void maybe_invalid_constant (const CIbyte *, Lisp_Object, Lisp_Object,
 			     Error_Behavior);
 DECLARE_DOESNT_RETURN (wtaerror (const CIbyte *reason, Lisp_Object frob));
-DECLARE_DOESNT_RETURN (out_of_memory (const CIbyte *reason,
-				      Lisp_Object frob));
+MODULE_API DECLARE_DOESNT_RETURN (out_of_memory (const CIbyte *reason,
+						 Lisp_Object frob));
 DECLARE_DOESNT_RETURN (stack_overflow (const CIbyte *reason,
 				       Lisp_Object frob));
+MODULE_API
 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (printing_unreadable_object
 						  (const CIbyte *,
 						   ...), 1, 2);
@@ -4139,11 +4154,11 @@
 			      Lisp_Object (*) (Lisp_Object, Lisp_Object),
 			      Lisp_Object);
 Lisp_Object condition_case_3 (Lisp_Object, Lisp_Object, Lisp_Object);
-Lisp_Object unbind_to_1 (int, Lisp_Object);
+MODULE_API Lisp_Object unbind_to_1 (int, Lisp_Object);
 #define unbind_to(obj) unbind_to_1 (obj, Qnil)
 void specbind (Lisp_Object, Lisp_Object);
-int record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object);
-int record_unwind_protect_freeing (void *ptr);
+MODULE_API int record_unwind_protect (Lisp_Object (*) (Lisp_Object),
+				      Lisp_Object);
 int record_unwind_protect_freeing_dynarr (void *ptr);
 int record_unwind_protect_restoring_int (int *addr, int val);
 int internal_bind_int (int *addr, int newval);
@@ -4151,8 +4166,8 @@
 void do_autoload (Lisp_Object, Lisp_Object); /* GCPROs both arguments */
 Lisp_Object un_autoload (Lisp_Object);
 void warn_when_safe_lispobj (Lisp_Object, Lisp_Object, Lisp_Object);
-void warn_when_safe (Lisp_Object, Lisp_Object, const CIbyte *,
-		     ...) PRINTF_ARGS (3, 4);
+MODULE_API void warn_when_safe (Lisp_Object, Lisp_Object, const CIbyte *,
+				...) PRINTF_ARGS (3, 4);
 extern int backtrace_with_internal_sections;
 
 extern Lisp_Object Vstack_trace_on_error;
@@ -4239,7 +4254,8 @@
 extern Lisp_Object Qcanonicalize_after_coding;
 int coding_system_is_for_text_file (Lisp_Object coding_system);
 Lisp_Object find_coding_system_for_text_file (Lisp_Object name, int eol_wrap);
-Lisp_Object get_coding_system_for_text_file (Lisp_Object name, int eol_wrap);
+MODULE_API Lisp_Object get_coding_system_for_text_file (Lisp_Object name,
+							int eol_wrap);
 int coding_system_is_binary (Lisp_Object coding_system);
 
 
@@ -4293,7 +4309,7 @@
 double extract_float (Lisp_Object);
 
 /* Defined in fns.c */
-EXFUN (Fappend, MANY);
+MODULE_API EXFUN (Fappend, MANY);
 EXFUN (Fassoc, 2);
 EXFUN (Fassq, 2);
 EXFUN (Fcanonicalize_lax_plist, 2);
@@ -4308,17 +4324,17 @@
 EXFUN (Fdelq, 2);
 EXFUN (Fdestructive_alist_to_plist, 1);
 EXFUN (Felt, 2);
-EXFUN (Fequal, 2);
-EXFUN (Fget, 3);
+MODULE_API EXFUN (Fequal, 2);
+MODULE_API EXFUN (Fget, 3);
 EXFUN (Flast, 2);
 EXFUN (Flax_plist_get, 3);
 EXFUN (Flax_plist_remprop, 2);
-EXFUN (Flength, 1);
+MODULE_API EXFUN (Flength, 1);
 EXFUN (Fmapcar, 2);
 EXFUN (Fmember, 2);
 EXFUN (Fmemq, 2);
 EXFUN (Fnconc, MANY);
-EXFUN (Fnreverse, 1);
+MODULE_API EXFUN (Fnreverse, 1);
 EXFUN (Fnthcdr, 2);
 EXFUN (Fold_assq, 2);
 EXFUN (Fold_equal, 2);
@@ -4327,11 +4343,12 @@
 EXFUN (Fplist_get, 3);
 EXFUN (Fplist_member, 2);
 EXFUN (Fplist_put, 3);
-EXFUN (Fprovide, 1);
-EXFUN (Fput, 3);
+MODULE_API EXFUN (Fprovide, 1);
+MODULE_API EXFUN (Fput, 3);
 EXFUN (Frassq, 2);
 EXFUN (Fremassq, 2);
 EXFUN (Freplace_list, 2);
+MODULE_API EXFUN (Freverse, 1);
 EXFUN (Fsafe_length, 1);
 EXFUN (Fsort, 2);
 EXFUN (Fstring_equal, 2);
@@ -4501,7 +4518,7 @@
 void message_internal (const Ibyte *, Lisp_Object, Bytecount, Bytecount);
 void message_append_internal (const Ibyte *, Lisp_Object,
 			      Bytecount, Bytecount);
-void message (const char *, ...) PRINTF_ARGS (1, 2);
+MODULE_API void message (const char *, ...) PRINTF_ARGS (1, 2);
 void message_append (const char *, ...) PRINTF_ARGS (1, 2);
 void message_no_translate (const char *, ...) PRINTF_ARGS (1, 2);
 void clear_message (void);
@@ -4530,17 +4547,17 @@
 /* NOTE: Do not call this with the data of a Lisp_String.  Use princ.
  * Note: stream should be defaulted before calling
  *  (eg Qnil means stdout, not Vstandard_output, etc) */
-void write_c_string (Lisp_Object stream, const CIbyte *str);
+MODULE_API void write_c_string (Lisp_Object stream, const CIbyte *str);
 /* Same goes for this function. */
-void write_string (Lisp_Object stream, const Ibyte *str);
+MODULE_API void write_string (Lisp_Object stream, const Ibyte *str);
 /* Same goes for this function. */
 void write_string_1 (Lisp_Object stream, const Ibyte *str, Bytecount size);
 void write_eistring (Lisp_Object stream, const Eistring *ei);
 
 /* Higher-level (printf-style) ways to output data: */
-void write_fmt_string (Lisp_Object stream, const CIbyte *fmt, ...);
-void write_fmt_string_lisp (Lisp_Object stream, const CIbyte *fmt,
-			    int nargs, ...);
+MODULE_API void write_fmt_string (Lisp_Object stream, const CIbyte *fmt, ...);
+MODULE_API void write_fmt_string_lisp (Lisp_Object stream, const CIbyte *fmt,
+				       int nargs, ...);
 void stderr_out (const CIbyte *, ...) PRINTF_ARGS (1, 2);
 void stderr_out_lisp (const CIbyte *, int nargs, ...);
 void stdout_out (const CIbyte *, ...) PRINTF_ARGS (1, 2);
@@ -4570,7 +4587,7 @@
 (((2410824 * sizeof (integral_type)) / 1000000) + 3)
 void long_to_string (char *, long);
 extern int print_escape_newlines;
-extern int print_readably;
+extern MODULE_API int print_readably;
 Lisp_Object internal_with_output_to_temp_buffer (Lisp_Object,
 						 Lisp_Object (*) (Lisp_Object),
 						 Lisp_Object, Lisp_Object);
@@ -4659,7 +4676,7 @@
 
 unsigned int hash_string (const Ibyte *, Bytecount);
 Lisp_Object intern_int (const Ibyte *str);
-Lisp_Object intern (const CIbyte *str);
+MODULE_API Lisp_Object intern (const CIbyte *str);
 Lisp_Object intern_converting_underscores_to_dashes (const CIbyte *str);
 Lisp_Object oblookup (Lisp_Object, const Ibyte *, Bytecount);
 void map_obarray (Lisp_Object, int (*) (Lisp_Object, void *), void *);
@@ -5161,8 +5178,8 @@
 extern Lisp_Object Qforeground, Qformat, Qframe_live_p, Qgraphic;
 extern Lisp_Object Qgui_error, Qicon_glyph_p, Qidentity, Qinhibit_quit;
 extern Lisp_Object Qinhibit_read_only, Qinteger_char_or_marker_p;
-extern Lisp_Object Qinteger_or_char_p, Qinteger_or_marker_p, Qintegerp;
-extern Lisp_Object Qinteractive, Qinternal_error, Qinvalid_argument;
+extern Lisp_Object Qinteger_or_char_p, Qinteger_or_marker_p;
+extern Lisp_Object Qinteractive, Qinternal_error;
 extern Lisp_Object Qinvalid_byte_code, Qinvalid_change, Qinvalid_constant;
 extern Lisp_Object Qinvalid_function, Qinvalid_operation;
 extern Lisp_Object Qinvalid_read_syntax, Qinvalid_state, Qio_error, Qlambda;
@@ -5176,7 +5193,7 @@
 extern Lisp_Object Qoverflow_error, Qpoint, Qpointer_glyph_p;
 extern Lisp_Object Qpointer_image_instance_p, Qprint_length;
 extern Lisp_Object Qprint_string_length, Qprinting_unreadable_object;
-extern Lisp_Object Qprocess_error, Qprogn, Qquit, Qquote, Qrange_error;
+extern Lisp_Object Qprogn, Qquit, Qquote, Qrange_error;
 extern Lisp_Object Qread_char, Qread_from_minibuffer;
 extern Lisp_Object Qreally_early_error_handler, Qregion_beginning;
 extern Lisp_Object Qregion_end, Qregistry, Qreverse_direction_charset;
@@ -5186,15 +5203,19 @@
 extern Lisp_Object Qsound_error, Qstack_overflow, Qstandard_input;
 extern Lisp_Object Qstandard_output, Qstart_open, Qstring_lessp;
 extern Lisp_Object Qstructure_formation_error, Qsubwindow;
-extern Lisp_Object Qsubwindow_image_instance_p, Qsyntax_error, Qt;
+extern Lisp_Object Qsubwindow_image_instance_p;
 extern Lisp_Object Qtext_conversion_error, Qtext_image_instance_p, Qtop_level;
-extern Lisp_Object Qtrue_list_p, Qunbound, Qunderflow_error, Qunderline;
+extern Lisp_Object Qtrue_list_p, Qunderflow_error, Qunderline;
 extern Lisp_Object Quser_files_and_directories, Qvalues;
 extern Lisp_Object Qvariable_documentation, Qvariable_domain, Qvoid_function;
 extern Lisp_Object Qvoid_variable, Qwindow_live_p, Qwrong_number_of_arguments;
 extern Lisp_Object Qwrong_type_argument, Qyes_or_no_p;
 
+extern MODULE_API Lisp_Object Qintegerp, Qinvalid_argument, Qprocess_error;
+extern MODULE_API Lisp_Object Qsyntax_error, Qt, Qunbound;
+
 #define SYMBOL(fou) extern Lisp_Object fou
+#define SYMBOL_MODULE_API(fou) extern MODULE_API Lisp_Object fou
 #define SYMBOL_KEYWORD(la_cle_est_fou) extern Lisp_Object la_cle_est_fou
 #define SYMBOL_GENERAL(tout_le_monde, est_fou) \
   extern Lisp_Object tout_le_monde
@@ -5202,6 +5223,7 @@
 #include "general-slots.h"
 
 #undef SYMBOL
+#undef SYMBOL_MODULE_API
 #undef SYMBOL_KEYWORD
 #undef SYMBOL_GENERAL
 
--- a/src/lrecord.h	Mon Aug 18 21:52:34 2003 +0000
+++ b/src/lrecord.h	Tue Aug 19 02:07:16 2003 +0000
@@ -218,7 +218,7 @@
   lrecord_type_last_built_in_type /* must be last */
 };
 
-extern int lrecord_type_count;
+extern MODULE_API int lrecord_type_count;
 
 struct lrecord_implementation
 {
@@ -301,7 +301,8 @@
    room in `lrecord_implementations_table' for such new lisp object types. */
 #define MODULE_DEFINABLE_TYPE_COUNT 32
 
-extern const struct lrecord_implementation *lrecord_implementations_table[lrecord_type_last_built_in_type + MODULE_DEFINABLE_TYPE_COUNT];
+extern MODULE_API const struct lrecord_implementation *
+lrecord_implementations_table[lrecord_type_last_built_in_type + MODULE_DEFINABLE_TYPE_COUNT];
 
 #define XRECORD_LHEADER_IMPLEMENTATION(obj) \
    LHEADER_IMPLEMENTATION (XRECORD_LHEADER (obj))
@@ -919,7 +920,7 @@
     getprop, putprop, remprop, plist, size, sizer,			\
     lrecord_type_last_built_in_type, basic_p }
 
-extern Lisp_Object (*lrecord_markers[]) (Lisp_Object);
+extern MODULE_API Lisp_Object (*lrecord_markers[]) (Lisp_Object);
 
 #define INIT_LRECORD_IMPLEMENTATION(type) do {				\
   lrecord_implementations_table[lrecord_type_##type] = &lrecord_##type;	\
@@ -1134,6 +1135,18 @@
 }									  \
 extern Lisp_Object Q##c_name##p
 
+# define DECLARE_MODULE_API_LRECORD(c_name, structtype)			  \
+extern MODULE_API const struct lrecord_implementation lrecord_##c_name;	  \
+DECLARE_INLINE_HEADER (							  \
+structtype *								  \
+error_check_##c_name (Lisp_Object obj, const char *file, int line)	  \
+)									  \
+{									  \
+  assert_at_line (RECORD_TYPEP (obj, lrecord_type_##c_name), file, line); \
+  return (structtype *) XPNTR (obj);					  \
+}									  \
+extern MODULE_API Lisp_Object Q##c_name##p
+
 # define DECLARE_EXTERNAL_LRECORD(c_name, structtype)			  \
 extern int lrecord_type_##c_name;					  \
 extern struct lrecord_implementation lrecord_##c_name;			  \
@@ -1347,8 +1360,9 @@
 void free_managed_lcrecord (Lisp_Object lcrecord_list, Lisp_Object lcrecord);
 
 /* AUTO-MANAGED MODEL: */
-void *alloc_automanaged_lcrecord (Bytecount size,
-				  const struct lrecord_implementation *);
+MODULE_API void *
+alloc_automanaged_lcrecord (Bytecount size,
+			    const struct lrecord_implementation *);
 #define alloc_lcrecord_type(type, lrecord_implementation) \
   ((type *) alloc_automanaged_lcrecord (sizeof (type), lrecord_implementation))
 void free_lcrecord (Lisp_Object rec);
@@ -1464,7 +1478,7 @@
 
 /* Nonzero means Emacs has already been initialized.
    Used during startup to detect startup of dumped Emacs.  */
-extern int initialized;
+extern MODULE_API int initialized;
 
 #ifdef PDUMP
 
--- a/src/mem-limits.h	Mon Aug 18 21:52:34 2003 +0000
+++ b/src/mem-limits.h	Tue Aug 19 02:07:16 2003 +0000
@@ -112,7 +112,7 @@
 
 #if defined (HEAP_IN_DATA) && !defined(PDUMP)
 extern unsigned long static_heap_size;
-extern int initialized;
+extern MODULE_API int initialized;
 static void
 get_lim_data (void)
 {
--- a/src/opaque.h	Mon Aug 18 21:52:34 2003 +0000
+++ b/src/opaque.h	Tue Aug 19 02:07:16 2003 +0000
@@ -63,8 +63,8 @@
 #define wrap_opaque_ptr(p) wrap_record (p, opaque_ptr)
 #define OPAQUE_PTRP(x) RECORDP (x, opaque_ptr)
 
-Lisp_Object make_opaque_ptr (void *val);
-void free_opaque_ptr (Lisp_Object ptr);
+MODULE_API Lisp_Object make_opaque_ptr (void *val);
+MODULE_API void free_opaque_ptr (Lisp_Object ptr);
 
 #define get_opaque_ptr(op) (XOPAQUE_PTR (op)->ptr)
 #define set_opaque_ptr(op, ptr_) (XOPAQUE_PTR (op)->ptr = (ptr_))
--- a/src/process.h	Mon Aug 18 21:52:34 2003 +0000
+++ b/src/process.h	Tue Aug 19 02:07:16 2003 +0000
@@ -66,12 +66,13 @@
 EXFUN (Fprocess_kill_without_query, 2);
 EXFUN (Fprocess_id, 1);
 
+MODULE_API
 DECLARE_DOESNT_RETURN (report_process_error (const char *, Lisp_Object));
 DECLARE_DOESNT_RETURN (report_network_error (const char *, Lisp_Object));
 extern Lisp_Object Vlisp_EXEC_SUFFIXES;
 
-Ibyte *egetenv (const CIbyte *var);
-void eputenv (const CIbyte *var, const CIbyte *value);
+MODULE_API Ibyte *egetenv (const CIbyte *var);
+MODULE_API void eputenv (const CIbyte *var, const CIbyte *value);
 extern int env_initted;
 
 extern Lisp_Object Qprocess_live_p;
--- a/src/symeval.h	Mon Aug 18 21:52:34 2003 +0000
+++ b/src/symeval.h	Tue Aug 19 02:07:16 2003 +0000
@@ -275,24 +275,27 @@
    DEFUN ("name, Fname, ...); // at top level in foo.c
    DEFSUBR (Fname);           // in syms_of_foo();
 */
-void defsubr (Lisp_Subr *);
+MODULE_API void defsubr (Lisp_Subr *);
 #define DEFSUBR(Fname) defsubr (&S##Fname)
 
 /* To define a Lisp primitive macro using a C function `Fname', do this:
    DEFUN ("name, Fname, ...); // at top level in foo.c
    DEFSUBR_MACRO (Fname);     // in syms_of_foo();
 */
-void defsubr_macro (Lisp_Subr *);
+MODULE_API void defsubr_macro (Lisp_Subr *);
 #define DEFSUBR_MACRO(Fname) defsubr_macro (&S##Fname)
 
-void defsymbol_massage_name (Lisp_Object *location, const char *name);
-void defsymbol_massage_name_nodump (Lisp_Object *location, const char *name);
-void defsymbol_massage_multiword_predicate (Lisp_Object *location,
-					    const char *name);
-void defsymbol_massage_multiword_predicate_nodump (Lisp_Object *location,
-						   const char *name);
-void defsymbol (Lisp_Object *location, const char *name);
-void defsymbol_nodump (Lisp_Object *location, const char *name);
+MODULE_API void defsymbol_massage_name (Lisp_Object *location,
+					const char *name);
+MODULE_API void defsymbol_massage_name_nodump (Lisp_Object *location,
+					       const char *name);
+MODULE_API void defsymbol_massage_multiword_predicate (Lisp_Object *location,
+						       const char *name);
+MODULE_API void
+defsymbol_massage_multiword_predicate_nodump (Lisp_Object *location,
+					      const char *name);
+MODULE_API void defsymbol (Lisp_Object *location, const char *name);
+MODULE_API void defsymbol_nodump (Lisp_Object *location, const char *name);
 
 /* Defining symbols:
 
@@ -327,16 +330,19 @@
 #define DEFSYMBOL_MULTIWORD_PREDICATE_NO_DUMP(name) \
   defsymbol_massage_multiword_predicate_nodump (&name, #name)
 
-void defkeyword (Lisp_Object *location, const char *name);
-void defkeyword_massage_name (Lisp_Object *location, const char *name);
+MODULE_API void defkeyword (Lisp_Object *location, const char *name);
+MODULE_API void defkeyword_massage_name (Lisp_Object *location,
+					 const char *name);
 #define DEFKEYWORD(name) defkeyword_massage_name (&name, #name)
 
-void deferror (Lisp_Object *symbol, const char *name,
-	       const char *message, Lisp_Object inherits_from);
-void deferror_massage_name (Lisp_Object *symbol, const char *name,
-			    const char *message, Lisp_Object inherits_from);
-void deferror_massage_name_and_message (Lisp_Object *symbol, const char *name,
-					Lisp_Object inherits_from);
+MODULE_API void deferror (Lisp_Object *symbol, const char *name,
+			  const char *message, Lisp_Object inherits_from);
+MODULE_API void deferror_massage_name (Lisp_Object *symbol, const char *name,
+				       const char *message,
+				       Lisp_Object inherits_from);
+MODULE_API void deferror_massage_name_and_message (Lisp_Object *symbol,
+						   const char *name,
+						   Lisp_Object inherits_from);
 #define DEFERROR(name, message, inherits_from) \
   deferror_massage_name (&name, #name, message, inherits_from)
 /* In this case, the error message is the same as the name, modulo some
@@ -347,8 +353,8 @@
 /* Macros we use to define forwarded Lisp variables.
    These are used in the syms_of_FILENAME functions.  */
 
-void defvar_magic (const char *symbol_name,
-		   const struct symbol_value_forward *magic);
+MODULE_API void defvar_magic (const char *symbol_name,
+			      const struct symbol_value_forward *magic);
 
 #define DEFVAR_SYMVAL_FWD(lname, c_location, forward_type, magicfun)	\
 do									\
--- a/src/sysdll.c	Mon Aug 18 21:52:34 2003 +0000
+++ b/src/sysdll.c	Tue Aug 19 02:07:16 2003 +0000
@@ -210,11 +210,10 @@
 {
   return dld_get_symbol (n);
 }
-#elif defined (WIN32_NATIVE)
+#elif defined (WIN32_NATIVE) || defined (CYGWIN)
 
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
+#include "syswindows.h"
+#include "sysfile.h"
 
 int
 dll_init (const char *arg)
@@ -225,7 +224,10 @@
 dll_handle
 dll_open (const char *fname)
 {
-  return (dll_handle) LoadLibrary (fname);
+  Ibyte *winfname, *unifname;
+  LOCAL_TO_WIN32_FILE_FORMAT ((char *) fname, winfname);
+  C_STRING_TO_TSTR (winfname, unifname);
+  return (dll_handle) qxeLoadLibrary (unifname);
 }
 
 int
@@ -249,7 +251,10 @@
 const char *
 dll_error (dll_handle h)
 {
-  return "Windows DLL Error";
+  /* 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;
 }
 #elif defined(HAVE_DYLD)
 /* This section supports MacOSX dynamic libraries. Dynamically
--- a/src/text.h	Mon Aug 18 21:52:34 2003 +0000
+++ b/src/text.h	Tue Aug 19 02:07:16 2003 +0000
@@ -125,7 +125,7 @@
    This value can be derived in other ways -- e.g. something like
    XCHARSET_REP_BYTES (charset_by_leading_byte (first_byte))
    but it's faster this way. */
-extern const Bytecount rep_bytes_by_first_byte[0xA0];
+extern MODULE_API const Bytecount rep_bytes_by_first_byte[0xA0];
 
 /* Number of bytes in the string representation of a character. */
 
@@ -336,7 +336,7 @@
 
 #endif /* MULE */
 
-int dfc_coding_system_is_unicode (Lisp_Object codesys);
+MODULE_API int dfc_coding_system_is_unicode (Lisp_Object codesys);
 
 DECLARE_INLINE_HEADER (
 Bytecount dfc_external_data_len (const void *ptr, Lisp_Object codesys)
@@ -606,8 +606,10 @@
 
 #ifdef MULE
 
-Charcount bytecount_to_charcount_fun (const Ibyte *ptr, Bytecount len);
-Bytecount charcount_to_bytecount_fun (const Ibyte *ptr, Charcount len);
+MODULE_API Charcount
+bytecount_to_charcount_fun (const Ibyte *ptr, Bytecount len);
+MODULE_API Bytecount
+charcount_to_bytecount_fun (const Ibyte *ptr, Charcount len);
 
 /* Given a pointer to a text string and a length in bytes, return
    the equivalent length in characters. */
@@ -799,9 +801,9 @@
 
 #ifdef MULE
 
-Ichar non_ascii_itext_ichar (const Ibyte *ptr);
-Bytecount non_ascii_set_itext_ichar (Ibyte *ptr, Ichar c);
-Bytecount non_ascii_itext_copy_ichar (const Ibyte *src, Ibyte *dst);
+MODULE_API Ichar non_ascii_itext_ichar (const Ibyte *ptr);
+MODULE_API Bytecount non_ascii_set_itext_ichar (Ibyte *ptr, Ichar c);
+MODULE_API Bytecount non_ascii_itext_copy_ichar (const Ibyte *src, Ibyte *dst);
 
 /* Retrieve the character pointed to by PTR as an Ichar. */
 
@@ -994,7 +996,7 @@
 
 #ifdef MULE
 
-int non_ascii_valid_ichar_p (Ichar ch);
+MODULE_API int non_ascii_valid_ichar_p (Ichar ch);
 
 /* Return whether the given Ichar is valid.
  */
@@ -2691,13 +2693,13 @@
 /* WARNING: These use a static buffer.  This can lead to disaster if
    these functions are not used *very* carefully.  Another reason to only use
    TO_EXTERNAL_FORMAT() and TO_INTERNAL_FORMAT(). */
-void
+MODULE_API void
 dfc_convert_to_external_format (dfc_conversion_type source_type,
 				dfc_conversion_data *source,
 				Lisp_Object codesys,
 				dfc_conversion_type sink_type,
 				dfc_conversion_data *sink);
-void
+MODULE_API void
 dfc_convert_to_internal_format (dfc_conversion_type source_type,
 				dfc_conversion_data *source,
 				Lisp_Object codesys,
@@ -2886,12 +2888,14 @@
   DFC_LISP_STRING
 };
 
-void *new_dfc_convert_malloc (const void *src, Bytecount src_size,
-			      enum new_dfc_src_type type, Lisp_Object codesys);
-void *new_dfc_convert_alloca (const char *srctext, void *alloca_data);
-Bytecount new_dfc_convert_size (const char *srctext, const void *src,
-				Bytecount src_size, enum new_dfc_src_type type,
-				Lisp_Object codesys);
+MODULE_API void *new_dfc_convert_malloc (const void *src, Bytecount src_size,
+					 enum new_dfc_src_type type,
+					 Lisp_Object codesys);
+MODULE_API void *new_dfc_convert_alloca (const char *srctext, void *alloca_data);
+MODULE_API Bytecount new_dfc_convert_size (const char *srctext, const void *src,
+					   Bytecount src_size,
+					   enum new_dfc_src_type type,
+					   Lisp_Object codesys);
 
 /* Version of EXTERNAL_TO_C_STRING that *RETURNS* the translated string,
    still in alloca() space.  Requires some trickiness to do this, but gets
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/xemacs.def.in.in	Tue Aug 19 02:07:16 2003 +0000
@@ -0,0 +1,205 @@
+/* Put the usual header here */
+/* The symbol to import/export is on the left.  If the symbol is not
+   meant to be used directly, but a macro or inline function in the
+   API expands to a form containing the symbol, then the macro or
+   inline function is named in a comment to the right. */
+#define NOT_C_CODE
+#include <config.h>
+NAME xemacs.exe
+EXPORTS
+/* Exported functions */
+acons
+alloc_automanaged_lcrecord	/* alloc_lcrecord_type */
+#ifdef USE_ASSERTIONS
+assert_failed			/* abort(), assert(), etc. */
+#endif
+build_ext_string
+build_intstring
+build_msg_intstring
+build_msg_string
+build_string
+#ifdef MULE
+bytecount_to_charcount_fun	/* bytecount_to_charcount */
+charcount_to_bytecount_fun	/* charcount_to_bytecount */
+#endif
+check_quit			/* QUITP */
+check_what_happened		/* QUIT */
+cons3
+copy_lisp_object
+dead_wrong_type_argument	/* CHECK_xxx */
+#ifdef DEBUG_GCPRO
+debug_gcpro1			/* GCPRO1 */
+debug_gcpro2			/* GCPRO2 */
+debug_gcpro3			/* GCPRO3 */
+debug_gcpro4			/* GCPRO4 */
+debug_gcpro5			/* GCPRO5 */
+debug_ungcpro			/* UNGCPRO */
+#endif
+deferror
+deferror_massage_name		/* DEFERROR */
+deferror_massage_name_and_message /* DEFERROR_STANDARD */
+defkeyword
+defkeyword_massage_name		/* DEFKEYWORD */
+defsubr				/* DEFSUBR */
+defsubr_macro			/* DEFSUBR_MACRO */
+defsymbol
+defsymbol_nodump		/* == defsymbol in modules */
+defsymbol_massage_multiword_predicate /* DEFSYMBOL_MULTIWORD_PREDICATE */
+defsymbol_massage_multiword_predicate_nodump /* DEFSYMBOL_MULTIWORD_PREDICATE_NO_DUMP */
+defsymbol_massage_name		/* DEFSYMBOL */
+defsymbol_massage_name_nodump	/* DEFSYMBOL_NO_DUMP == DEFSYMBOL in modules */
+defvar_magic			/* DEFVAR_LISP, DEFVAR_INT, ... */
+dfc_coding_system_is_unicode	/* TO_INTERNAL_FORMAT */
+dfc_convert_to_external_format	/* TO_EXTERNAL_FORMAT */
+dfc_convert_to_internal_format	/* TO_INTERNAL_FORMAT */
+egetenv				
+#ifndef EMODULES_GATHER_VERSION
+emodules_doc_subr		/* CDOCSUBR */
+emodules_doc_sym		/* CDOCSYM */
+#endif
+eputenv
+#ifdef DEBUG_XEMACS
+eq_with_ebola_notice		/* EQ_WITH_EBOLA_NOTICE */
+#endif
+free_opaque_ptr
+get_coding_system_for_text_file
+intern
+invalid_argument
+invalid_argument_2
+invalid_constant
+invalid_operation
+invalid_operation_2
+list1
+list2
+list3
+list4
+list5
+list6
+make_ext_string
+make_float
+make_opaque_ptr
+make_string
+make_vector
+maybe_invalid_operation
+message
+new_dfc_convert_alloca		/* C_STRING_TO_EXTERNAL, ... */
+new_dfc_convert_malloc		/* C_STRING_TO_EXTERNAL_MALLOC, ... */
+new_dfc_convert_size		/* C_STRING_TO_EXTERNAL, ... */
+#ifdef MULE
+non_ascii_itext_copy_ichar	/* itext_copy_ichar */
+non_ascii_itext_ichar		/* itext_ichar */
+non_ascii_set_itext_ichar	/* set_itext_ichar */
+non_ascii_valid_ichar_p		/* valid_ichar_p */
+#endif
+out_of_memory			/* The postgresql module uses this */
+printing_unreadable_object
+record_unwind_protect
+record_unwind_protect_freeing
+report_process_error
+signal_error
+signal_ferror
+signal_quit			/* QUIT */
+#ifndef DEBUG_XEMACS
+staticpro
+staticpro_nodump
+#else
+staticpro_1
+staticpro_nodump_1
+#endif
+unbind_to_1			/* unbind_to */
+#ifndef DEBUG_XEMACS
+unstaticpro_nodump
+#else
+unstaticpro_nodump_1
+#endif
+vector1
+vector2
+vector3
+warn_when_safe
+write_c_string
+write_fmt_string
+write_fmt_string_lisp
+write_string
+wrong_type_argument		/* CONCHECK_xxx */
+xemacs_c_alloca			/* ALLOCA */
+#ifdef ERROR_CHECK_MALLOC
+xfree_1				/* xfree */
+#else
+xfree
+#endif
+xmalloc
+xmalloc_and_zero
+xrealloc
+xstrdup
+Dynarr_delete_many		/* Dynarr_delete, Dynarr_delete_object, ... */
+Dynarr_free
+Dynarr_insert_many		/* Dynarr_add_{literal,lisp}_string */
+Dynarr_newf			/* Dynarr_new, Dynarr_new2 */
+Dynarr_resize			/* Dynarr_add */
+Fappend
+Fbuffer_modified_p
+Fbuffer_name
+Fcons
+Fcurrent_buffer
+Fequal
+Fexpand_abbrev
+Fget
+Fkill_buffer
+Flength
+Flist
+Fmake_list
+Fmake_string
+Fmake_symbol
+Fmake_vector
+Fnreverse
+Fprovide
+Fput
+Freverse
+Fset_buffer
+Fvector
+
+/* Exported variables */
+__temp_alloca_size__		/* ALLOCA */
+#ifdef DEBUG_XEMACS
+debug_issue_ebola_notices	/* EQ_WITH_EBOLA_NOTICE */
+#endif
+dont_check_for_quit		/* QUITP, QUIT */
+gcprolist			/* GCPRO1, GCPRO2, ... */
+initialized			/* LOADHIST_ATTACH */
+lrecord_cons			/* CONSP */
+lrecord_implementations_table	/* RECORD_DUMPABLE */
+lrecord_marker			/* MARKERP */
+lrecord_markers			/* INIT_LRECORD_IMPLEMENTATION */
+lrecord_string			/* STRINGP */
+lrecord_symbol	 		/* SYMBOLP */
+lrecord_type_count		/* INIT_EXTERNAL_LRECORD_IMPLEMENTATION */
+need_to_check_c_alloca		/* ALLOCA */
+print_readably
+quit_check_signal_happened	/* QUITP */
+#ifdef ERROR_CHECK_MALLOC
+regex_malloc_disallowed		/* REGEX_MALLOC_CHECK */
+#endif
+#ifdef MULE
+rep_bytes_by_first_byte		/* itext_ichar_len, INC_IBYTEPTR, ... */
+#endif
+something_happened		/* QUIT */
+specpdl_depth_counter		/* specpdl_depth */
+Qconsp				/* CHECK_CONS */
+Qfile_name			/* Qdll_filename_encoding */
+Qintegerp			/* CHECK_INT, CONCHECK_INT */
+Qinvalid_argument
+Qnative
+Qnil
+Qnotice
+#ifdef USE_UNION_TYPE
+Qnull_pointer			/* DEFVAR_xxx */
+#endif
+Qprocess_error
+Qstringp			/* CHECK_STRING */
+Qsymbolp			/* CHECK_SYMBOL */
+Qsyntax_error
+Qt
+Qunbound
+#ifdef USE_UNION_TYPE
+Qzero				/* ZEROP */
+#endif