Ethereal-dev: [Ethereal-dev] Re: fixing the build
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: "Stefan (metze) Metzmacher" <metze@xxxxxxxxx>
Date: Wed, 19 Apr 2006 10:12:17 +0200
>Stefan (metze) Metzmacher wrote: >> the problem is that register_all_protocols() exists twice, > > >...but one is in libethereal and one is in the docsis plugin. > > >> but the the internal one is called twice, > > Why is that? That's not happening on OS X - does the run-time linker > on other platforms find the libethereal register_all_protocols() > rather than the one in the plugin when it's loading the plugin? On SuSE Linux 9.3 it doesn't work... > If so, is there any way to fix that? I'd really prefer not to have > "plugin.c" include the name of the plugin - I'd like to have it be > something that's the same for all plugins. (I suppose if we really > *need* to have the register routines have different names in the > different plugins, we could do that with token pasting.) this patch also works for me please CC: me in the reply, thanks metze
=== epan/dissectors/Makefile.am
==================================================================
--- epan/dissectors/Makefile.am (revision 2204)
+++ epan/dissectors/Makefile.am (local)
@@ -79,10 +79,11 @@
$(top_srcdir)/tools/make-reg-dotc.py
@if test -n $(PYTHON); then \
echo Making register.c with python ; \
- $(PYTHON) $(top_srcdir)/tools/make-reg-dotc.py $(srcdir) $(DISSECTOR_SRC) ; \
+ $(PYTHON) $(top_srcdir)/tools/make-reg-dotc.py $(srcdir) "" \
+ $(plugin_src) $(DISSECTOR_SRC) ; \
else \
echo Making register.c with shell script ; \
- $(top_srcdir)/tools/make-reg-dotc register.c $(srcdir) \
+ $(SHELL) $(top_srcdir)/tools/make-reg-dotc register.c $(srcdir) "" \
$(plugin_src) $(DISSECTOR_SRC) ; \
fi
=== plugins/docsis/Makefile.am
==================================================================
--- plugins/docsis/Makefile.am (revision 2204)
+++ plugins/docsis/Makefile.am (local)
@@ -71,11 +71,10 @@
$(top_srcdir)/tools/make-reg-dotc.py
@if test -n $(PYTHON); then \
echo Making register.c with python ; \
- $(PYTHON) $(top_srcdir)/tools/make-reg-dotc.py $(srcdir) $(DISSECTOR_SRC) ; \
+ $(PYTHON) $(top_srcdir)/tools/make-reg-dotc.py $(srcdir) "static" $(DISSECTOR_SRC) ; \
else \
echo Making register.c with shell script ; \
- $(top_srcdir)/tools/make-reg-dotc register.c $(srcdir) \
- $(plugin_src) $(DISSECTOR_SRC) ; \
+ $(SHELL) $(top_srcdir)/tools/make-reg-dotc register.c $(srcdir) "static" $(DISSECTOR_SRC) ; \
fi
#
=== plugins/docsis/plugin.c
==================================================================
--- plugins/docsis/plugin.c (revision 2204)
+++ plugins/docsis/plugin.c (local)
@@ -35,8 +35,7 @@
/* Start the functions we need for the plugin stuff */
-extern void register_all_protocols(void);
-extern void register_all_protocol_handoffs(void);
+#include "register.c"
G_MODULE_EXPORT void
plugin_register (void)
=== tools/make-reg-dotc
==================================================================
--- tools/make-reg-dotc (revision 2204)
+++ tools/make-reg-dotc (local)
@@ -18,17 +18,22 @@
shift
#
+# The scope of the generated functions.
+#
+scope="$1"
+shift
+
+#
# All subsequent arguments are the files to scan.
#
rm -f ${outfile}-tmp
echo '/* Do not modify this file. */' >${outfile}-tmp
echo '/* It is created automatically by the Makefile. */'>>${outfile}-tmp
-echo '#include "register.h"' >>${outfile}-tmp
#
# Build code to call all the protocol registration routines.
#
-echo 'void register_all_protocols(void) {' >>${outfile}-tmp
+echo "${scope} void register_all_protocols(void) {" >>${outfile}-tmp
for f in "$@"
do
if [ -f $f ]
@@ -54,7 +59,7 @@
#
# Build code to call all the protocol handoff registration routines.
#
-echo 'void register_all_protocol_handoffs(void) {' >>${outfile}-tmp
+echo "${scope} void register_all_protocol_handoffs(void) {" >>${outfile}-tmp
for f in "$@"
do
if [ -f $f ]
=== tools/make-reg-dotc.py
==================================================================
--- tools/make-reg-dotc.py (revision 2204)
+++ tools/make-reg-dotc.py (local)
@@ -24,15 +24,19 @@
srcdir = sys.argv[1]
#
+# The second argument is the scope of the generated functions.
+#
+scope = sys.argv[2]
+
+#
# All subsequent arguments are the files to scan.
#
-files = sys.argv[2:]
+files = sys.argv[3:]
reg_code = open(tmp_filename, "w")
reg_code.write("/* Do not modify this file. */\n")
reg_code.write("/* It is created automatically by the Makefile. */\n")
-reg_code.write('#include "register.h"\n')
# Create the proper list of filenames
filenames = []
@@ -84,7 +88,8 @@
handoff_reg.sort()
# Make register_all_protocols()
-reg_code.write("void register_all_protocols(void) {\n")
+line = "%s void register_all_protocols(void) {\n" % (scope)
+reg_code.write(line)
for symbol in proto_reg:
line = " {extern void %s (void); %s ();}\n" % (symbol, symbol)
@@ -94,7 +99,8 @@
# Make register_all_protocol_handoffs()
-reg_code.write("void register_all_protocol_handoffs(void) {\n")
+line = "%s void register_all_protocol_handoffs(void) {\n" % (scope)
+reg_code.write(line)
for symbol in handoff_reg:
line = " {extern void %s (void); %s ();}\n" % (symbol, symbol)
Attachment:
signature.asc
Description: OpenPGP digital signature
- Follow-Ups:
- Re: [Ethereal-dev] Re: fixing the build
- From: Guy Harris
- Re: [Ethereal-dev] Re: fixing the build
- References:
- [Ethereal-dev] fixing the build
- From: Stefan (metze) Metzmacher
- [Ethereal-dev] fixing the build
- Prev by Date: [Ethereal-dev] urgent
- Next by Date: [Ethereal-dev] BACnet: display invoke-id in main datagramme list
- Previous by thread: Re: [Ethereal-dev] fixing the build
- Next by thread: Re: [Ethereal-dev] Re: fixing the build
- Index(es):





