]> granicus.if.org Git - libexpat/commitdiff
clean up the macro restructuring, and make it play nice on Windows
authorFred L. Drake, Jr. <fdrake@users.sourceforge.net>
Wed, 15 Oct 2003 20:51:28 +0000 (20:51 +0000)
committerFred L. Drake, Jr. <fdrake@users.sourceforge.net>
Wed, 15 Oct 2003 20:51:28 +0000 (20:51 +0000)
expat/lib/expat.h
expat/lib/xmlparse.c

index 17c4ff0ed8f2d1d71e12353d3d4c4bbc9b6d1c1a..0087b5a4fd5fa41642b548838338cc13c014742d 100644 (file)
@@ -20,7 +20,7 @@
 #define XML_USE_MSC_EXTENSIONS 1
 #endif
 
-/* Expat tries very hard to make the API buondary very specifically
+/* Expat tries very hard to make the API boundary very specifically
    defined.  There are two macros defined to control this boundary;
    each of these can be defined before including this header to
    achieve some different behavior, but doing so it not recommended or
 #endif  /* not defined XMLCALL */
 
 
-#if !defined(XMLIMPORT) && !defined(XML_STATIC)
+#if !defined(XML_STATIC) && !defined(XMLIMPORT)
+#ifdef XML_BUILDING_EXPAT
+/* we're actually building Expat itself */
+
+#if defined(__GNUC__)
+/* needed in a very obscure case according the the GCC documentation
+   (Windows NT on PowerPC) */
+#define XMLIMPORT __attribute__((dllexport))
+#endif
+
+#else
+/* using Expat from an application */
+
 #ifdef XML_USE_MSC_EXTENSIONS
 #define XMLIMPORT __declspec(dllimport)
+#elif defined(__GNUC__)
+/* needed in a very obscure case according the the GCC documentation
+   (Windows NT on PowerPC) */
+#define XMLIMPORT __attribute__((dllimport))
 #endif
+
 #endif
+#endif  /* not defined XML_STATIC */
 
+/* If we didn't define it above, define it away: */
 #ifndef XMLIMPORT
 #define XMLIMPORT
 #endif
 
+
 #define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
 
 #ifdef __cplusplus
index 4d0c9b7ad2350155a9d805efad6a9810ad206fe7..ed39e524cd640a1f8a368f419eaca3c5c48307b5 100644 (file)
@@ -5,27 +5,18 @@
 #include <stddef.h>
 #include <string.h>                     /* memset(), memcpy() */
 
-#ifdef COMPILED_FROM_DSP
+#define XML_BUILDING_EXPAT 1
 
+#ifdef COMPILED_FROM_DSP
 #include "winconfig.h"
-#define XMLPARSEAPI(type) type __cdecl
-#include "expat.h"
-
 #elif defined(MACOS_CLASSIC)
-
 #include "macconfig.h"
-#include "expat.h"
-
 #else
-
 #include <expat_config.h>
-
-#define XMLIMPORT
+#endif /* ndef COMPILED_FROM_DSP */
 
 #include "expat.h"
 
-#endif /* ndef COMPILED_FROM_DSP */
-
 #ifdef XML_UNICODE
 #define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX
 #define XmlConvert XmlUtf16Convert