Ethereal-dev: [Ethereal-dev] Patch to link plugins with libethereal instead of old plugin api

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Lars Roland <lars.roland@xxxxxxx>
Date: Sat, 25 Sep 2004 01:43:56 +0200
Hello all,

attached diffs add an option to config.nmake to link plugins with libethereal. This makes the plugin address table obsolete. However the plugin address table is not removed to provide compatibility for plugins using it.

I have updated the nmake makefiles of all plugins and the template in README.plugins to enable them using the new option. Additionally all plugins get linked using the common linker flags of (t)ethereal. I removed my previous changes to the mgcp plugin, so it looks like the other plugins again.

Some duplicated lines of code in config.h.win32 and the main makefile have been removed, too.

Please check in.

Regards,
Lars
Index: ethereal-new/doc/README.plugins
===================================================================
--- ethereal-new/doc/README.plugins	(revision 12083)
+++ ethereal-new/doc/README.plugins	(working copy)
@@ -148,10 +148,19 @@
 CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
 	/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
 
+LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
+
+!IFDEF LINK_PLUGINS_WITH_LIBETHEREAL
+LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
+CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB $(CFLAGS)
+!ELSE
+LINK_PLUGIN_WITH=..\plugin_api.obj
+!ENDIF
+
 OBJECTS=packet-xxx.obj 
 
-xxx.dll xxx.exp xxx.lib : $(OBJECTS) ..\plugin_api.obj
-	link -dll /out:xxx.dll $(OBJECTS) ..\plugin_api.obj \
+xxx.dll xxx.exp xxx.lib : $(OBJECTS) $(LINK_PLUGIN_WITH)
+	link -dll /out:xxx.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
 	$(GLIB_LIBS)
 
 clean:
Index: ethereal-new/config.h.win32
===================================================================
--- ethereal-new/config.h.win32	(revision 12083)
+++ ethereal-new/config.h.win32	(working copy)
@@ -33,6 +33,16 @@
 #define HAVE_PLUGINS		1
 #define PLUGINS_NEED_ADDRESS_TABLE 1
 
+/* Plugins can also use the import library of libethereal.dll instead
+   of the old API. In that case we undefine PLUGINS_NEED_ADDRESS_TABLE 
+   for the plugin. We don't undefine PLUGINS_NEED_ADDRESS_TABLE globally.
+   Thus Ethereal will be still able to load plugins using the old API. 
+   The makro HAVE_WIN32_LIBETHEREAL_LIB has to be defined in plugin's 
+   makefile.nmake. A template is available in doc/README.plugins */
+#ifdef HAVE_WIN32_LIBETHEREAL_LIB
+#undef PLUGINS_NEED_ADDRESS_TABLE
+#endif
+
 /* #undef HAVE_SA_LEN */
 
 /* #undef NEED_SNPRINTF_H */
@@ -169,17 +179,6 @@
 /* Define to use the PCRE library */
 @HAVE_PCRE@
 
-@HAVE_LIBETHEREALDLL@
-
-/* define macro for importing variables from an dll 
- * it depends on HAVE_LIBETHEREAL and _NEED_VAR_IMPORT_
- */
-#if defined (_NEED_VAR_IMPORT_) && defined (HAVE_LIBETHEREALDLL)
-#  define ETH_VAR_IMPORT __declspec(dllimport) extern
-#else
-#  define ETH_VAR_IMPORT extern
-#endif
-
 #ifndef WIN32
 #define WIN32			1
 #endif
Index: ethereal-new/config.nmake
===================================================================
--- ethereal-new/config.nmake	(revision 12083)
+++ ethereal-new/config.nmake	(working copy)
@@ -222,6 +222,11 @@
 # following line
 ENABLE_LIBETHEREAL=USE
 
+!IFDEF ENABLE_LIBETHEREAL
+# Uncomment next line to link plugins with the import library of libethereal.dll 
+#LINK_PLUGINS_WITH_LIBETHEREAL=USE
+!ENDIF
+
 #
 # You should not have to change anything below this comment.
 # If you do, it's a deficiency in the Makefile.nmake files;

Index: ethereal-new/Makefile.nmake
===================================================================
--- ethereal-new/Makefile.nmake	(revision 12083)
+++ ethereal-new/Makefile.nmake	(working copy)
@@ -213,7 +213,6 @@
 	    -e "s/@HAVE_PCAP_DATALINK_VAL_TO_NAME@/$(PCAP_DATALINK_VAL_TO_NAME_CONFIG)/" \
 	    -e "s/@HAVE_LIBETHEREALDLL@/$(LIBETHEREAL_CONFIG)/" \
 	    -e "s/@WPCAP_CONSTIFIED@/$(WPCAP_CONSTIFIED_CONFIG)/" \
-	    -e "s/@HAVE_LIBETHEREALDLL@/$(LIBETHEREAL_CONFIG)/" \
 	    < config.h.win32 > $@
 
 ps.c	: rdps.exe print.ps
Index: ethereal-new/plugins/irda/Makefile.nmake
===================================================================
--- ethereal-new/plugins/irda/Makefile.nmake	(revision 12083)
+++ ethereal-new/plugins/irda/Makefile.nmake	(working copy)
@@ -9,10 +9,19 @@
 CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
 	/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
 
+LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
+
+!IFDEF LINK_PLUGINS_WITH_LIBETHEREAL
+LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
+CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB $(CFLAGS)
+!ELSE
+LINK_PLUGIN_WITH=..\plugin_api.obj
+!ENDIF
+
 OBJECTS=packet-irda.obj packet-ircomm.obj packet-sir.obj
 
-irda.dll irda.exp irda.lib : $(OBJECTS) ..\plugin_api.obj
-	link -dll /out:irda.dll $(OBJECTS) ..\plugin_api.obj \
+irda.dll irda.exp irda.lib : $(OBJECTS) $(LINK_PLUGIN_WITH)
+	link -dll /out:irda.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
 	$(GLIB_LIBS)
 
 clean:
Index: ethereal-new/plugins/enttec/Makefile.nmake
===================================================================
--- ethereal-new/plugins/enttec/Makefile.nmake	(revision 12083)
+++ ethereal-new/plugins/enttec/Makefile.nmake	(working copy)
@@ -9,10 +9,19 @@
 CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
 	/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
 
+LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
+
+!IFDEF LINK_PLUGINS_WITH_LIBETHEREAL
+LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
+CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB $(CFLAGS)
+!ELSE
+LINK_PLUGIN_WITH=..\plugin_api.obj
+!ENDIF
+
 OBJECTS=packet-enttec.obj 
 
-enttec.dll enttec.exp enttec.lib : $(OBJECTS) ..\plugin_api.obj
-	link -dll /out:enttec.dll $(OBJECTS) ..\plugin_api.obj \
+enttec.dll enttec.exp enttec.lib : $(OBJECTS) $(LINK_PLUGIN_WITH)
+	link -dll /out:enttec.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
 	$(GLIB_LIBS)
 
 clean:
Index: ethereal-new/plugins/rdm/Makefile.nmake
===================================================================
--- ethereal-new/plugins/rdm/Makefile.nmake	(revision 12083)
+++ ethereal-new/plugins/rdm/Makefile.nmake	(working copy)
@@ -9,10 +9,19 @@
 CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
 	/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
 
+LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
+
+!IFDEF LINK_PLUGINS_WITH_LIBETHEREAL
+LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
+CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB $(CFLAGS)
+!ELSE
+LINK_PLUGIN_WITH=..\plugin_api.obj
+!ENDIF
+
 OBJECTS=packet-rdm.obj 
 
-rdm.dll rdm.exp rdm.lib : $(OBJECTS) ..\plugin_api.obj
-	link -dll /out:rdm.dll $(OBJECTS) ..\plugin_api.obj \
+rdm.dll rdm.exp rdm.lib : $(OBJECTS) $(LINK_PLUGIN_WITH)
+	link -dll /out:rdm.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
 	$(GLIB_LIBS)
 
 clean:
Index: ethereal-new/plugins/docsis/Makefile.nmake
===================================================================
--- ethereal-new/plugins/docsis/Makefile.nmake	(revision 12083)
+++ ethereal-new/plugins/docsis/Makefile.nmake	(working copy)
@@ -9,6 +9,15 @@
 CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
 	/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
 
+LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
+
+!IFDEF LINK_PLUGINS_WITH_LIBETHEREAL
+LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
+CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB $(CFLAGS)
+!ELSE
+LINK_PLUGIN_WITH=..\plugin_api.obj
+!ENDIF
+
 OBJECTS=packet-intrngreq.obj packet-type29ucd.obj \
 	packet-docsis.obj packet-bpkmattr.obj \
 	packet-dsarsp.obj packet-macmgmt.obj \
@@ -23,8 +32,8 @@
 	packet-dsareq.obj packet-dsdrsp.obj \
 	packet-rngreq.obj packet-vendor.obj
 
-docsis.dll docsis.exp docsis.lib : $(OBJECTS) ..\plugin_api.obj 
-	link -dll /out:docsis.dll $(OBJECTS) ..\plugin_api.obj  \
+docsis.dll docsis.exp docsis.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) 
+	link -dll /out:docsis.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH)  \
 	$(GLIB_LIBS)
 
 clean:
Index: ethereal-new/plugins/rlm/Makefile.nmake
===================================================================
--- ethereal-new/plugins/rlm/Makefile.nmake	(revision 12083)
+++ ethereal-new/plugins/rlm/Makefile.nmake	(working copy)
@@ -9,10 +9,19 @@
 CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
 	/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
 
+LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
+
+!IFDEF LINK_PLUGINS_WITH_LIBETHEREAL
+LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
+CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB $(CFLAGS)
+!ELSE
+LINK_PLUGIN_WITH=..\plugin_api.obj
+!ENDIF
+
 OBJECTS=packet-rlm.obj 
 
-rlm.dll rlm.exp rlm.lib : $(OBJECTS) ..\plugin_api.obj
-	link -dll /out:rlm.dll $(OBJECTS) ..\plugin_api.obj \
+rlm.dll rlm.exp rlm.lib : $(OBJECTS) $(LINK_PLUGIN_WITH)
+	link -dll /out:rlm.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
 	$(GLIB_LIBS)
 
 clean:
Index: ethereal-new/plugins/megaco/Makefile.nmake
===================================================================
--- ethereal-new/plugins/megaco/Makefile.nmake	(revision 12083)
+++ ethereal-new/plugins/megaco/Makefile.nmake	(working copy)
@@ -9,10 +9,19 @@
 CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
 	/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
 
+LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
+
+!IFDEF LINK_PLUGINS_WITH_LIBETHEREAL
+LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
+CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB $(CFLAGS)
+!ELSE
+LINK_PLUGIN_WITH=..\plugin_api.obj
+!ENDIF
+
 OBJECTS=packet-megaco.obj 
 
-megaco.dll megaco.exp megaco.lib : $(OBJECTS) ..\plugin_api.obj
-	link -dll /out:megaco.dll $(OBJECTS) ..\plugin_api.obj \
+megaco.dll megaco.exp megaco.lib : $(OBJECTS) $(LINK_PLUGIN_WITH)
+	link -dll /out:megaco.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
 	$(GLIB_LIBS)
 
 clean:
Index: ethereal-new/plugins/rtnet/Makefile.nmake
===================================================================
--- ethereal-new/plugins/rtnet/Makefile.nmake	(revision 12083)
+++ ethereal-new/plugins/rtnet/Makefile.nmake	(working copy)
@@ -9,10 +9,19 @@
 CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
 	/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
 
+LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
+
+!IFDEF LINK_PLUGINS_WITH_LIBETHEREAL
+LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
+CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB $(CFLAGS)
+!ELSE
+LINK_PLUGIN_WITH=..\plugin_api.obj
+!ENDIF
+
 OBJECTS=packet-rtnet.obj 
 
-rtnet.dll rtnet.exp rtnet.lib : $(OBJECTS) ..\plugin_api.obj
-	link -dll /out:rtnet.dll $(OBJECTS) ..\plugin_api.obj \
+rtnet.dll rtnet.exp rtnet.lib : $(OBJECTS) $(LINK_PLUGIN_WITH)
+	link -dll /out:rtnet.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
 	$(GLIB_LIBS)
 
 clean:
Index: ethereal-new/plugins/artnet/Makefile.nmake
===================================================================
--- ethereal-new/plugins/artnet/Makefile.nmake	(revision 12083)
+++ ethereal-new/plugins/artnet/Makefile.nmake	(working copy)
@@ -9,10 +9,19 @@
 CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
 	/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
 
+LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
+
+!IFDEF LINK_PLUGINS_WITH_LIBETHEREAL
+LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
+CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB $(CFLAGS)
+!ELSE
+LINK_PLUGIN_WITH=..\plugin_api.obj
+!ENDIF
+
 OBJECTS=packet-artnet.obj 
 
-artnet.dll artnet.exp artnet.lib : $(OBJECTS) ..\plugin_api.obj
-	link -dll /out:artnet.dll $(OBJECTS) ..\plugin_api.obj \
+artnet.dll artnet.exp artnet.lib : $(OBJECTS) $(LINK_PLUGIN_WITH)
+	link -dll /out:artnet.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
 	$(GLIB_LIBS)
 
 clean:
Index: ethereal-new/plugins/ciscosm/Makefile.nmake
===================================================================
--- ethereal-new/plugins/ciscosm/Makefile.nmake	(revision 12083)
+++ ethereal-new/plugins/ciscosm/Makefile.nmake	(working copy)
@@ -9,10 +9,19 @@
 CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
 	/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
 
+LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
+
+!IFDEF LINK_PLUGINS_WITH_LIBETHEREAL
+LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
+CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB $(CFLAGS)
+!ELSE
+LINK_PLUGIN_WITH=..\plugin_api.obj
+!ENDIF
+
 OBJECTS=packet-sm.obj 
 
-ciscosm.dll ciscosm.exp ciscosm.lib : $(OBJECTS) ..\plugin_api.obj
-	link -dll /out:ciscosm.dll $(OBJECTS) ..\plugin_api.obj \
+ciscosm.dll ciscosm.exp ciscosm.lib : $(OBJECTS) $(LINK_PLUGIN_WITH)
+	link -dll /out:ciscosm.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
 	$(GLIB_LIBS)
 
 clean:
Index: ethereal-new/plugins/acn/Makefile.nmake
===================================================================
--- ethereal-new/plugins/acn/Makefile.nmake	(revision 12083)
+++ ethereal-new/plugins/acn/Makefile.nmake	(working copy)
@@ -9,10 +9,19 @@
 CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
 	/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
 
+LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
+
+!IFDEF LINK_PLUGINS_WITH_LIBETHEREAL
+LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
+CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB $(CFLAGS)
+!ELSE
+LINK_PLUGIN_WITH=..\plugin_api.obj
+!ENDIF
+
 OBJECTS=packet-acn.obj 
 
-acn.dll acn.exp acn.lib : $(OBJECTS) ..\plugin_api.obj
-	link -dll /out:acn.dll $(OBJECTS) ..\plugin_api.obj \
+acn.dll acn.exp acn.lib : $(OBJECTS) $(LINK_PLUGIN_WITH)
+	link -dll /out:acn.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
 	$(GLIB_LIBS)
 
 clean:
Index: ethereal-new/plugins/asn1/Makefile.nmake
===================================================================
--- ethereal-new/plugins/asn1/Makefile.nmake	(revision 12083)
+++ ethereal-new/plugins/asn1/Makefile.nmake	(working copy)
@@ -9,10 +9,19 @@
 CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
 	/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
 
+LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
+
+!IFDEF LINK_PLUGINS_WITH_LIBETHEREAL
+LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
+CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB $(CFLAGS)
+!ELSE
+LINK_PLUGIN_WITH=..\plugin_api.obj
+!ENDIF
+
 OBJECTS=packet-asn1.obj 
 
-asn1.dll asn1.exp asn1.lib : $(OBJECTS) ..\plugin_api.obj
-	link -dll /out:asn1.dll $(OBJECTS) ..\plugin_api.obj \
+asn1.dll asn1.exp asn1.lib : $(OBJECTS) $(LINK_PLUGIN_WITH)
+	link -dll /out:asn1.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
 	$(GLIB_LIBS)
 
 clean:
Index: ethereal-new/plugins/v5ua/Makefile.nmake
===================================================================
--- ethereal-new/plugins/v5ua/Makefile.nmake	(revision 12083)
+++ ethereal-new/plugins/v5ua/Makefile.nmake	(working copy)
@@ -9,10 +9,19 @@
 CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
 	/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
 
+LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
+
+!IFDEF LINK_PLUGINS_WITH_LIBETHEREAL
+LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
+CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB $(CFLAGS)
+!ELSE
+LINK_PLUGIN_WITH=..\plugin_api.obj
+!ENDIF
+
 OBJECTS=packet-v5ua.obj 
 
-v5ua.dll v5ua.exp v5ua.lib : $(OBJECTS) ..\plugin_api.obj
-	link -dll /out:v5ua.dll $(OBJECTS) ..\plugin_api.obj \
+v5ua.dll v5ua.exp v5ua.lib : $(OBJECTS) $(LINK_PLUGIN_WITH)
+	link -dll /out:v5ua.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
 	$(GLIB_LIBS)
 
 clean:
Index: ethereal-new/plugins/gryphon/Makefile.nmake
===================================================================
--- ethereal-new/plugins/gryphon/Makefile.nmake	(revision 12083)
+++ ethereal-new/plugins/gryphon/Makefile.nmake	(working copy)
@@ -9,10 +9,19 @@
 CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
 	/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
 
+LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
+
+!IFDEF LINK_PLUGINS_WITH_LIBETHEREAL
+LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
+CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB $(CFLAGS)
+!ELSE
+LINK_PLUGIN_WITH=..\plugin_api.obj
+!ENDIF
+
 OBJECTS=packet-gryphon.obj 
 
-gryphon.dll gryphon.exp gryphon.lib : $(OBJECTS) ..\plugin_api.obj
-	link -dll /out:gryphon.dll $(OBJECTS) ..\plugin_api.obj \
+gryphon.dll gryphon.exp gryphon.lib : $(OBJECTS) $(LINK_PLUGIN_WITH)
+	link -dll /out:gryphon.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
 	$(GLIB_LIBS)
 
 clean:
Index: ethereal-new/plugins/mgcp/Makefile.nmake
===================================================================
--- ethereal-new/plugins/mgcp/Makefile.nmake	(revision 12083)
+++ ethereal-new/plugins/mgcp/Makefile.nmake	(working copy)
@@ -4,30 +4,24 @@
 
 include ..\..\config.nmake
 
-# If you want this plugin to use libethereal.lib instead 
-# of the standard plugin api, you have to comment out the next line
-#USE_LIBETHEREAL_LIB=YES
-
 ############### no need to modify below this line #########
 
 CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
 	/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
 
-!IFDEF ENABLE_LIBETHEREAL
-!IFDEF USE_LIBETHEREAL_LIB
+LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
+
+!IFDEF LINK_PLUGINS_WITH_LIBETHEREAL
 LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
 CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB $(CFLAGS)
-!ENDIF
-!ENDIF
-
-!IFNDEF LINK_PLUGIN_WITH
+!ELSE
 LINK_PLUGIN_WITH=..\plugin_api.obj
 !ENDIF
 
 OBJECTS=packet-mgcp.obj 
 
 mgcp.dll mgcp.exp mgcp.lib : $(OBJECTS) $(LINK_PLUGIN_WITH)
-	link -dll /out:mgcp.dll $(OBJECTS) $(LINK_PLUGIN_WITH) \
+	link -dll /out:mgcp.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
 	$(GLIB_LIBS)
 
 clean:
Index: ethereal-new/plugins/mgcp/packet-mgcp.c
===================================================================
--- ethereal-new/plugins/mgcp/packet-mgcp.c	(revision 12083)
+++ ethereal-new/plugins/mgcp/packet-mgcp.c	(working copy)
@@ -36,9 +36,7 @@
 #include "config.h"
 #endif
 
-#ifndef HAVE_WIN32_LIBETHEREAL_LIB
 #include "plugins/plugin_api.h"
-#endif
 
 #include "moduleinfo.h"
 
@@ -56,9 +54,7 @@
 #include "packet-mgcp.h"
 #include "../../tap.h"
 
-#ifndef HAVE_WIN32_LIBETHEREAL_LIB
 #include "plugins/plugin_api_defs.h"
-#endif
 
 #ifndef ENABLE_STATIC
 G_MODULE_EXPORT const gchar version[] = VERSION;
@@ -1725,8 +1721,6 @@
   proto_reg_handoff_mgcp();
 }
 
-#ifndef HAVE_WIN32_LIBETHEREAL_LIB
-
 G_MODULE_EXPORT void
 plugin_init(plugin_address_table_t *pat
 #ifndef PLUGINS_NEED_ADDRESS_TABLE
@@ -1736,10 +1730,6 @@
   /* initialise the table of pointers needed in Win32 DLLs */
   plugin_address_table_init(pat);
   
-#else /* HAVE_WIN32_LIBETHEREAL_LIB */
-G_MODULE_EXPORT void plugin_init(void *dummy _U_)
-{
-#endif
   /* register the new protocol, protocol fields, and subtrees */
   if (proto_mgcp == -1) { /* execute protocol initialization only once */
     proto_register_mgcp();
Index: ethereal-new/plugins/pcli/Makefile.nmake
===================================================================
--- ethereal-new/plugins/pcli/Makefile.nmake	(revision 12083)
+++ ethereal-new/plugins/pcli/Makefile.nmake	(working copy)
@@ -9,10 +9,19 @@
 CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
 	/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
 
+LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
+
+!IFDEF LINK_PLUGINS_WITH_LIBETHEREAL
+LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
+CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB $(CFLAGS)
+!ELSE
+LINK_PLUGIN_WITH=..\plugin_api.obj
+!ENDIF
+
 OBJECTS=packet-pcli.obj 
 
-pcli.dll pcli.exp pcli.lib : $(OBJECTS) ..\plugin_api.obj
-	link -dll /out:pcli.dll $(OBJECTS) ..\plugin_api.obj \
+pcli.dll pcli.exp pcli.lib : $(OBJECTS) $(LINK_PLUGIN_WITH)
+	link -dll /out:pcli.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
 	$(GLIB_LIBS)
 
 clean:
Index: ethereal-new/plugins/lwres/Makefile.nmake
===================================================================
--- ethereal-new/plugins/lwres/Makefile.nmake	(revision 12083)
+++ ethereal-new/plugins/lwres/Makefile.nmake	(working copy)
@@ -9,10 +9,19 @@
 CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
 	/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
 
+LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
+
+!IFDEF LINK_PLUGINS_WITH_LIBETHEREAL
+LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
+CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB $(CFLAGS)
+!ELSE
+LINK_PLUGIN_WITH=..\plugin_api.obj
+!ENDIF
+
 OBJECTS=packet-lwres.obj 
 
-lwres.dll lwres.exp lwres.lib : $(OBJECTS) ..\plugin_api.obj
-	link -dll /out:lwres.dll $(OBJECTS) ..\plugin_api.obj \
+lwres.dll lwres.exp lwres.lib : $(OBJECTS) $(LINK_PLUGIN_WITH)
+	link -dll /out:lwres.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
 	$(GLIB_LIBS)
 
 clean:
Index: ethereal-new/plugins/giop/Makefile.nmake
===================================================================
--- ethereal-new/plugins/giop/Makefile.nmake	(revision 12083)
+++ ethereal-new/plugins/giop/Makefile.nmake	(working copy)
@@ -9,16 +9,25 @@
 CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
 	/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
 
+LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
+
+!IFDEF LINK_PLUGINS_WITH_LIBETHEREAL
+LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
+CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB $(CFLAGS)
+!ELSE
+LINK_PLUGIN_WITH=..\plugin_api.obj
+!ENDIF
+
 OBJECTS=packet-cosnaming.obj  packet-coseventcomm.obj
 
 all : cosnaming.dll coseventcomm.dll
 
-cosnaming.dll cosnaming.exp cosnaming.lib : packet-cosnaming.obj ..\plugin_api.obj
-	link -dll /out:cosnaming.dll packet-cosnaming.obj ..\plugin_api.obj \
+cosnaming.dll cosnaming.exp cosnaming.lib : packet-cosnaming.obj $(LINK_PLUGIN_WITH)
+	link -dll /out:cosnaming.dll $(LDFLAGS) packet-cosnaming.obj $(LINK_PLUGIN_WITH) \
 	$(GLIB_LIBS)
 
-coseventcomm.dll coseventcomm.exp coseventcomm.lib : packet-coseventcomm.obj ..\plugin_api.obj
-	link -dll /out:coseventcomm.dll packet-coseventcomm.obj ..\plugin_api.obj \
+coseventcomm.dll coseventcomm.exp coseventcomm.lib : packet-coseventcomm.obj $(LINK_PLUGIN_WITH)
+	link -dll /out:coseventcomm.dll $(LDFLAGS) packet-coseventcomm.obj $(LINK_PLUGIN_WITH) \
 	$(GLIB_LIBS)
 
 clean:
Index: ethereal-new/plugins/rudp/Makefile.nmake
===================================================================
--- ethereal-new/plugins/rudp/Makefile.nmake	(revision 12083)
+++ ethereal-new/plugins/rudp/Makefile.nmake	(working copy)
@@ -9,10 +9,19 @@
 CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
 	/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
 
+LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
+
+!IFDEF LINK_PLUGINS_WITH_LIBETHEREAL
+LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
+CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB $(CFLAGS)
+!ELSE
+LINK_PLUGIN_WITH=..\plugin_api.obj
+!ENDIF
+
 OBJECTS=packet-rudp.obj 
 
-rudp.dll rudp.exp rudp.lib : $(OBJECTS) ..\plugin_api.obj
-	link -dll /out:rudp.dll $(OBJECTS) ..\plugin_api.obj \
+rudp.dll rudp.exp rudp.lib : $(OBJECTS) $(LINK_PLUGIN_WITH)
+	link -dll /out:rudp.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
 	$(GLIB_LIBS)
 
 clean:
Index: ethereal-new/plugins/opsi/Makefile.nmake
===================================================================
--- ethereal-new/plugins/opsi/Makefile.nmake	(revision 12083)
+++ ethereal-new/plugins/opsi/Makefile.nmake	(working copy)
@@ -9,10 +9,19 @@
 CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
 	/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
 
+LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
+
+!IFDEF LINK_PLUGINS_WITH_LIBETHEREAL
+LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
+CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB $(CFLAGS)
+!ELSE
+LINK_PLUGIN_WITH=..\plugin_api.obj
+!ENDIF
+
 OBJECTS=packet-opsi.obj 
 
-opsi.dll opsi.exp opsi.lib : $(OBJECTS) ..\plugin_api.obj
-	link -dll /out:opsi.dll $(OBJECTS) ..\plugin_api.obj \
+opsi.dll opsi.exp opsi.lib : $(OBJECTS) $(LINK_PLUGIN_WITH)
+	link -dll /out:opsi.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
 	$(GLIB_LIBS)
 
 clean: