Ethereal-dev: Re: [Ethereal-dev] enabling libethereal.dll with MSVC

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

From: Guy Harris <gharris@xxxxxxxxx>
Date: Sun, 2 May 2004 15:06:17 -0700
On Sun, May 02, 2004 at 08:08:27PM +0200, Lars Roland wrote:
> A lot of global variables are exported from libethereal to (t)ethereal, 
> mainly value_string lists which are used within taps. Instead of 
> providing functions to access these variables, I decided to use the 
> necessary __declspec(dllimport) to make MSVC happy. As this is a MSVC 
> native macro which is only available with MSVC (are you surprised?), I 
> had to do a lot of small changes to a lot of files. The macros 
> "HAVE_LIBETHEREALDLL" and "_NEED_VAR_IMPORT_" are introduced just for 
> this problem. "HAVE_LIBETHEREAL" makes sure that the MSVC native macro 
> is used only when we build with a libetheral.dll and "_NEED_VAR_IMPORT_" 
> makes sure that it is used only when building with MSVC and only when 
> compiling the files which need it.

gmodule.h in GLib has a G_MODULE_EXPORT #define that's either
"__declspec(dllexport)" or empty; you might want to take a similar
approach, and have some header file define ETH_VAR_IMPORT as
"__declspec(dllimport)" or empty, depending on whether _NEED_VAR_IMPORT_
and HAVE_LIBETHEREALDLL are defined, and put ETH_VAR_IMPORT in front of
declarations of variables imported from libethereal.