Wireshark-dev: [Wireshark-dev] Linking to conversation_set_port2

From: Evan Beachly <evanb@xxxxxxxxxxxx>
Date: Mon, 14 Jul 2014 15:46:09 -0500
Hello,

I am developing a packet dissector plugin for a protocol that is basically a slightly modified version of Trivial File Transfer Protocol. To do this, I started by copying the existing packet-tftp.c & packet-tftp.h into a new plugin, renaming the protocol, and trying to build it.

When I do this, I get two linker errors:
error LNK2019: unresolved external symbol _tvb_format_stringzpad referenced in function _dissect_tftp_message
error LNK2019: unresolved external symbol _conversation_set_port2 referenced in function _dissect_tftp_message

Both of these functions are declared as extern in their header files, and do not have the WS_DLL_PUBLIC macro, which (I presume) exports the function to the dll.

The first function, tvb_format_stringzpad, appears to be functionally similar to tvb_get_const_stringz, which does get exported, so I can replace the first function with that.

However, I do not know how to solve the second linker error.

My question is: Is there some way to link to conversation_set_port2, or should this function be exported?

I've tried linking conversation.obj to my plugin, but then I get errors because it redefines the functions that do get exported.

When I replace the extern keyword with WS_DLL_PUBLIC and rebuild Wireshark, the plugin works. However, since I'm fairly new to this, I'm hesitant to make changes to Wireshark's source.

Thank you for your time,
Evan Beachly