ok, win32 plugins in libxslt work with the patch below with the default
cruntime /MD and /MDd.

the patch adds a new target "testplugin", and makes a few small changes
to testplugin.c so that we export only xmlsoft_org_xslt_testplugin_init
and no other symbols.

i wanted to get win32 working before i went and hacked out support
for static libxslt linking & plugins.

jr
Index: tests/plugins/testplugin.c
===================================================================
RCS file: /cvs/gnome/libxslt/tests/plugins/testplugin.c,v
retrieving revision 1.3
diff -u -w -b -B -r1.3 testplugin.c
--- tests/plugins/testplugin.c  20 Jan 2005 20:06:12 -0000      1.3
+++ tests/plugins/testplugin.c  30 Jan 2005 02:50:56 -0000
@@ -9,7 +9,6 @@
  * [EMAIL PROTECTED]
  */
 
-#define IN_LIBXSLT
 #include <libxslt/libxslt.h>
 
 #ifdef WITH_MODULES
@@ -33,6 +32,14 @@
 
 #define XSLT_TESTPLUGIN_URL "http://xmlsoft.org/xslt/testplugin";
 
+/* make sure init function is exported on win32 */
+#if defined(_WIN32)
+  #define PLUGINPUBFUN __declspec(dllexport)
+#else
+  #define PLUGINPUBFUN
+#endif
+
+
 /************************************************************************
  *                                                                     *
  *             Test plugin module http://xmlsoft.org/xslt/testplugin           
        *
@@ -311,7 +318,7 @@
  */
 
 void
-XSLTPUBFUN xmlsoft_org_xslt_testplugin_init(void)
+PLUGINPUBFUN xmlsoft_org_xslt_testplugin_init(void)
 {
     xsltRegisterExtModuleFull((const xmlChar *) XSLT_TESTPLUGIN_URL,
                               xsltExtInitTest, xsltExtShutdownTest,
Index: win32/Makefile.msvc
===================================================================
RCS file: /cvs/gnome/libxslt/win32/Makefile.msvc,v
retrieving revision 1.17
diff -u -w -b -B -r1.17 Makefile.msvc
--- win32/Makefile.msvc 30 Jun 2004 16:43:53 -0000      1.17
+++ win32/Makefile.msvc 30 Jan 2005 02:50:57 -0000
@@ -329,6 +327,38 @@
 # Builds xsltproc and friends. Uses the implicit rule for commands.
 $(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxslt libxslta libexslt libexslta
 
+# plugins only work with non-static builds currently.
+!if "$(STATIC)" == "0"
+
+TESTPLUGIN_SRCDIR = $(BASEDIR)\tests\plugins
+TESTPLUGIN_DIR = $(TESTPLUGIN_SRCDIR)\plugin
+TESTPLUGIN_SO = xmlsoft_org_xslt_testplugin.dll
+TESTPLUGIN_OBJS = $(TESTPLUGIN_DIR)\testplugin.obj
+
+testplugin: 
+       if exist $(TESTPLUGIN_DIR) rmdir /S /Q $(TESTPLUGIN_DIR)
+       $(MAKE) $(TESTPLUGIN_DIR)\$(TESTPLUGIN_SO)
+
+$(TESTPLUGIN_DIR) :
+       if not exist $(TESTPLUGIN_DIR) mkdir $(TESTPLUGIN_DIR)
+
+{$(TESTPLUGIN_SRCDIR)}.c{$(TESTPLUGIN_DIR)}.obj::
+       $(CC) $(CFLAGS) /Fo$(TESTPLUGIN_DIR)\ /c $<
+
+# Creates the testplugin archive.
+$(TESTPLUGIN_DIR)\$(TESTPLUGIN_SO) : $(TESTPLUGIN_DIR) $(TESTPLUGIN_OBJS) 
libxslt
+       $(LD) $(LDFLAGS) /DLL $(XSLT_IMP) $(APPLIBS) $(LIBS)\
+               /OUT:$(TESTPLUGIN_DIR)\$(TESTPLUGIN_SO) \
+               $(TESTPLUGIN_OBJS)
+
+!else
+
+testplugin:
+       @echo "plugins are disabled with static=yes" 
+
+!endif
+
+
 # Source dependences should be autogenerated somehow here, but how to
 # do it? I have no clue.
 
Index: win32/configure.js
===================================================================
RCS file: /cvs/gnome/libxslt/win32/configure.js,v
retrieving revision 1.17
diff -u -w -b -B -r1.17 configure.js
--- win32/configure.js  28 Jan 2005 00:01:31 -0000      1.17
+++ win32/configure.js  30 Jan 2005 02:50:57 -0000
@@ -396,6 +396,15 @@
        buildStatic = 1;
 }
 
+if (buildStatic == 1 && withModules == 1) {
+       WScript.Echo("Warning: Disabling plugin support.");
+       WScript.Echo("");  
+  WScript.Echo("Modules cannot be enabled when a statically linked cruntime 
has");
+       WScript.Echo("been selected, or when xsltproc.exe is linked statically 
to libxslt.");
+       WScript.Echo("");  
+       withModules=0;
+}
+
 dirSep = "\\";
 //if (compiler == "mingw")
 //     dirSep = "/";
_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
[email protected]
http://mail.gnome.org/mailman/listinfo/xslt

Reply via email to