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

Wireshark-dev: [Wireshark-dev] Moving codecs to libwireshark or libwsutil?

From: Pascal Quantin <pascal.quantin@xxxxxxxxx>
Date: Mon, 30 Nov 2015 15:40:49 +0100
Hi all,

I tried to create a codecs plugin for Windows, but the plugin registration fails.

As reported previously on this list (https://www.wireshark.org/lists/wireshark-dev/201409/msg00043.html), this because the plugin itself ends with its own copy of register_codec function instead of using one exported by the main program. So the codecs of the plugin gets registered in a hash table local to the plugin.
I tried declaring register_codec as WS_DLL_PUBLIC but as expected it does not work and it triggers the following error:

       "D:\dev\wireshark\x64\Wireshark.sln" (default target) (1) ->
       "D:\dev\wireshark\x64\ALL_BUILD.vcxproj.metaproj" (default target) (2) -
       >
       "D:\dev\wireshark\x64\codecs\codecs.vcxproj.metaproj" (default target) (
       11) ->
       "D:\dev\wireshark\x64\codecs\codecs.vcxproj" (default target) (85) ->
       (ClCompile target) ->
         D:\dev\wireshark\git\codecs\codecs.c(160): warning C4273: 'register_co
       dec' : inconsistent dll linkage [D:\dev\wireshark\x64\codecs\codecs.vcxp
       roj]


       "D:\dev\wireshark\x64\Wireshark.sln" (default target) (1) ->
       "D:\dev\wireshark\x64\ALL_BUILD.vcxproj.metaproj" (default target) (2) -
       >
       "D:\dev\wireshark\x64\wireshark.vcxproj.metaproj" (default target) (50)
       ->
       "D:\dev\wireshark\x64\wireshark.vcxproj" (default target) (142) ->
       (Link target) ->
         LINK : fatal error LNK1149: output filename matches input filename 'D:
       \dev\wireshark\x64\run\Debug\Wireshark.lib' [D:\dev\wireshark\x64\wiresh
       ark.vcxproj]

    1 Warning(s)
    1 Error(s)

I'm not sure it makes sense anyway to have a library depending on a function (and global variable) from the main program. This sounds like bad design (and maybe not even doable on some platforms but I'm not very familiar of this kind of issues).

Should we move codecs functions to one of the existing libraries? Or add it to its own? Because so far this officially supported plugin type does not work at all (at least on Windows).

Regards,
Pascal.