Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] buildbot failure in Wireshark (developme

From: Jakub Zawadzki <darkjames-ws@xxxxxxxxxxxx>
Date: Sat, 16 Nov 2013 23:12:22 +0100
On Sat, Nov 16, 2013 at 12:25:53PM -0800, Guy Harris wrote:
> 
> On Nov 16, 2013, at 1:54 AM, buildbot-no-reply@xxxxxxxxxxxxx wrote:
> 
> > The Buildbot has detected a new failure on builder Windows-7-x64 while building Wireshark (development).
> > Full details are available at:
> > http://buildbot.wireshark.org/trunk/builders/Windows-7-x64/builds/7888
> > 
> > Buildbot URL: http://buildbot.wireshark.org/trunk/
> > 
> > Buildslave for this Build: windows-7-x64
> > 
> > Build Reason: scheduler
> > Build Source Stamp: 53366
> > Blamelist: darkjames
> > 
> > BUILD FAILED: failed nmake all
> 
> Would somebody with sufficient Windows build experience care to indicate what the right way is to handle a variable (not a function) that is:
> 
> 	exported by library A;
> 
> 	imported by library B;
> 
> 	declared in a header file that's included by the source file in library A that defines the variable and by the source files in library B that use the variable?
> 
> The problem is that the source file in library A *and* the source files in library B are *both* compiled with "this is going into a DLL" flag on Windows, as they *are* all going into DLLs on Windows, so that -D flag cannot be used to control whether the declaration in the header file is "this is being exported" (__declspec(dllexport)) and "this is being imported" (__declspec(dllimport)).

Ups, my fault.

Looking how it's done in glib (GLIB_VAR definition [1]):

#  ifdef G_PLATFORM_WIN32
#      ifdef GLIB_COMPILATION
#          define GLIB_VAR __declspec(dllexport)
#      else /* !GLIB_COMPILATION */
#        define GLIB_VAR extern __declspec(dllimport)
#  endif /* !G_PLATFORM_WIN32 */


In our bulding system the similar thing of GLIB_COMPILATION does WS_BUILD_DLL, but it's always set
when building library i.e. epan, wiretap, wsutil.


So we can't have one WS_BUILD_DLL because we need to distinguish if we want to export (the same library) or import symbol (different library) or use extern (the same library).

in Makefiles: -DWS_BUILD_DLL=EPAN, -DWS_BUILD_DLL=WSUTIL, WS_BUILD_DLL=WIRETAP

+ instead of one WS_DLL_PUBLIC we need to use some: WS_DLL_PUBLIC(EPAN), WS_BUILD_DLL(WSUTIL)...

later in WS_DLL_PUBLIC(x) compare #if x == WS_BUILD_DLL

Does it makes sense? Still it seems to be quite complicated for one bitswap variable... (revert?).

Kuba.

[1] https://git.gnome.org/browse/glib/tree/glib/gtypes.h