Ethereal-dev: [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: Lars Roland <Lars.Roland@xxxxxxx>
Date: Sun, 02 May 2004 20:08:27 +0200
Hello list,

finally I was able to build a libethereal.dll with MSVC. Attached are all the necessary patches to make it work. This should not have any effect on gcc builds, but that should be checked.

Here are the details:

First of all, an option is introduced into config.nmake, so you can still build ethereal the old way without a libethereal.dll just by changing this option. Default is without libethereal.dll.

In config.nmake "./wiretap" is removed from PATH . It is used only for building ethereal-filter.html. I want to keep the PATH environment variable as short as possible to prevent problems due to wrongly loaded files. doc/makefile.nmake is updated accordingly.

A new dissector.lib is build anyway with MSVC. It contains the dissectors and the dissector helpers.

"print.c" and "ps.c" are now part of the dissector_helpers, although they are not used by dissectors. It is just a quick hack to link both into libethereal. This was necessary to avoid some complications, as print.c imports some variables from packet-frame.c and packet-data.c, which are also part of libethereal.

"g711.c" doesn't belong to the "dissector_helpers" anymore, because it is only used in ethereal in the rtp tap and not in tethereal or in any dissector. "g711.c" is now part of "ethereal_sources" and will be linked with ethereal only. This isn't a necessary change.

A def-file for libethereal is provided.

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.

The nsis installer is updated, too.

TODO:
Replacement of plugin_api_table by def-file.

Comments andare welcome. Please test and check in if acceptable .

Best regards,

Lars


Attachment: diff.tar.gz
Description: GNU Zip compressed data