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
This commit is contained in:
Gerald Combs 2013-03-07 17:20:12 +00:00
parent a196e90c3b
commit 29ceca1b26
4 changed files with 51 additions and 5 deletions

View File

@ -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) @<<

View File

@ -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>

View File

@ -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"

View File

@ -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