diff options
author | Gerald Combs <gerald@wireshark.org> | 2013-03-07 17:20:12 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2013-03-07 17:20:12 +0000 |
commit | 29ceca1b26e3507105f8038eb5cd5ca6bb4871cc (patch) | |
tree | 0a094cc58d06b707af3e06662b9e7175df613033 | |
parent | a196e90c3b3f0b0aeccc008208e2dcb91293baa3 (diff) | |
download | wireshark-29ceca1b26e3507105f8038eb5cd5ca6bb4871cc.tar.gz wireshark-29ceca1b26e3507105f8038eb5cd5ca6bb4871cc.tar.bz2 wireshark-29ceca1b26e3507105f8038eb5cd5ca6bb4871cc.zip |
From Balint:
[PATCH 1/2] Revert "Try to fix the "LNK4217: locally defined symbol"
warnings.
This reverts commit r48158.
[PATCH 2/2] Employ small hack in editcap to link with a few objects from
libwireshark properly
From me:
Add the ability to reset symbol exports via ws_symbol_export.h's include
guard and do so in capinfos.c and editcap.c. We include ws_symbol_export.h
in over 200 files so it didn't seem to make sense to remove its include
guard entirely.
svn path=/trunk/; revision=48170
-rw-r--r-- | Makefile.nmake | 4 | ||||
-rw-r--r-- | capinfos.c | 13 | ||||
-rw-r--r-- | editcap.c | 15 | ||||
-rw-r--r-- | ws_symbol_export.h | 24 |
4 files changed, 51 insertions, 5 deletions
diff --git a/Makefile.nmake b/Makefile.nmake index 24b065714e..a6831a9374 100644 --- a/Makefile.nmake +++ b/Makefile.nmake @@ -327,7 +327,7 @@ rawshark.exe : $(LIBS_CHECK) config.h $(rawshark_OBJECTS) epan ui image\rawshark # (e.g. epan\plugins.obj) must be built first using epan\Makefile.nmake (which happens for 'nmake ... all'). # Linking with setargv.obj enables "wildcard expansion" of command-line arguments capinfos.obj : - $(CC) $(CFLAGS) -DENABLE_STATIC -Fd.\ -c capinfos.c + $(CC) $(CFLAGS) -Fd.\ -c capinfos.c capinfos.exe : $(LIBS_CHECK) config.h $(capinfos_OBJECTS) wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\capinfos.res @echo Linking $@ $(LINK) @<< @@ -340,7 +340,7 @@ capinfos.exe : $(LIBS_CHECK) config.h $(capinfos_OBJECTS) wsutil\libwsutil.lib w # XXX: This makefile does not properly handle doing a 'nmake ... editcap.exe' directly since some of the .objs # (e.g. epan\plugins.obj) must be built first using epan\Makefile.nmake (which happens for 'nmake ... all'). editcap.obj : - $(CC) $(CFLAGS) -DENABLE_STATIC -Fd.\ -c editcap.c + $(CC) $(CFLAGS) -Fd.\ -c editcap.c editcap.exe : $(LIBS_CHECK) config.h $(editcap_OBJECTS) wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\editcap.res @echo Linking $@ $(LINK) @<< diff --git a/capinfos.c b/capinfos.c index 5adc480618..eda4f2090e 100644 --- a/capinfos.c +++ b/capinfos.c @@ -75,10 +75,23 @@ #include <glib.h> +#include <wsutil/privileges.h> + +/* + * The symbols declared in the below are exported from libwireshark, + * but we don't want to link whole libwireshark to editcap. + * We link the object directly instead and this needs a little trick + * with the WS_BUILD_DLL #define. + */ +#define WS_BUILD_DLL +#define RESET_SYMBOL_EXPORT #include <epan/packet.h> #include <epan/filesystem.h> #include <epan/plugins.h> #include <epan/report_err.h> +#undef WS_BUILD_DLL +#define RESET_SYMBOL_EXPORT + #include "wtap.h" #include <wsutil/privileges.h> #include <wsutil/str_util.h> @@ -52,8 +52,6 @@ #include <unistd.h> #endif - - #ifdef HAVE_SYS_TIME_H #include <sys/time.h> #endif @@ -77,12 +75,23 @@ # include "wsutil/strptime.h" #endif +#include <wsutil/privileges.h> + +/* + * The symbols declared in the below are exported from libwireshark, + * but we don't want to link whole libwireshark to editcap. + * We link the object directly instead and this needs a little trick + * with the WS_BUILD_DLL #define. + */ +#define WS_BUILD_DLL +#define RESET_SYMBOL_EXPORT /* wsutil/wsgetopt.h set export behavior above. */ #include "epan/crypt/md5.h" #include "epan/plugins.h" #include "epan/report_err.h" #include "epan/filesystem.h" -#include <wsutil/privileges.h> #include "epan/nstime.h" +#undef WS_BUILD_DLL +#define RESET_SYMBOL_EXPORT #include "svnversion.h" diff --git a/ws_symbol_export.h b/ws_symbol_export.h index ac9b973053..f17136aba2 100644 --- a/ws_symbol_export.h +++ b/ws_symbol_export.h @@ -20,6 +20,30 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +/** Reset symbol export behavior. + * If you {un}define WS_BUILD_DLL on the fly you'll have to define this + * as well. + */ +#ifdef RESET_SYMBOL_EXPORT + +#ifdef SYMBOL_EXPORT_H +#undef SYMBOL_EXPORT_H +#endif + +#ifdef WS_DLL_PUBLIC +#undef WS_DLL_PUBLIC +#endif + +#ifdef WS_DLL_PUBLIC_NOEXTERN +#undef WS_DLL_PUBLIC_NOEXTERN +#endif + +#ifdef WS_DLL_LOCAL +#undef WS_DLL_LOCAL +#endif + +#endif /* RESET_SYMBOL_EXPORT */ + #ifndef SYMBOL_EXPORT_H #define SYMBOL_EXPORT_H |