ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Simpifying exporting DLL symbols

From: Bálint Réczey <balint@xxxxxxxxxxxxxxx>
Date: Tue, 26 Feb 2013 23:08:04 +0100
Hi Guy,

2013/2/26 Guy Harris <guy@xxxxxxxxxxxx>:
>
> On Feb 26, 2013, at 11:46 AM, Bálint Réczey <balint@xxxxxxxxxxxxxxx> wrote:
>
>> I have created the attached patch to control symbol visibility using
>> C defines instead of .def and .sym files.
>
> You might want to use comments on #else and #endif to make it a bit easier to figure out what #else is the opposite of and what #endif terminates.
I have updated the patch with the suggested comments.

>
>> It is expected to work on every platform and every build system we support,
>
> "Work" as in "not fail to compile", or "work" as in "keep symbols from being exported outside the library if not marked as being exported by the library"?
I would target compiling on every platform first, but in thecases
I have tested only the intended symbols got exported. :-)
I also had to add more symbols to the list, because tshark
did not compile without them.

>
> At least some UN*X compilers might support GCC-style __attribute__(visibility(...)) options, but I don't know whether all the ones that would be used to compile Wireshark, on platforms where the linker can hide symbols, do.
I suggest hiding the symbols where we can hide them by improving
the WS_DLL_PUBLIC defines (i.e. where we can do it without relying on libtool).
Exporting all symbols when using more exotic compilers should not be and issue,
because plugins used on such exotic systems are probably compiled with
GCC >= 4.0, LLVM
or Visual Studio too, and this ensures using exported APIs.

Cheers,
Balint