I've made a custom dissector plugin for Wireshark and have a weird linking error. This is my first plugin and am using MSVC 2010 express as my compiler. I get a linking error that it can't resolve the str_to_str function in value_string.h. It states "unresolved external symbol _str_to_str referenced in function xyz". I'm using value_string and string_string structs and have no problem compiling and linking other functions in the header (such as val_to_str). any thoughts or ideas why only some things in the header get linked? BTW also had this happen with the tvb_get_bits from tvbuff.h as well... asked 06 Oct '11, 13:04 redraymon edited 06 Oct '11, 13:05 |
One Answer:
The symbol needs to be exported from libwireshark. Edit epan\libwireshark.def and add an entry for answered 07 Oct '11, 01:05 grahamb ♦ edited 07 Oct '11, 01:16 I'll give this a try and see what I find out. (07 Oct '11, 06:16) redraymon Add the function to the libwireshark.def file and recompiled wireshark. Recompiled my plugin with no issues but trying to run the release version with it fails. Seems that the official release wasn't compiled with this function either... should this be suggested as a bug? New to this, how is that done? (07 Oct '11, 06:40) redraymon Normally opening a bug on https://bugs.wireshark.org is the way to go, but I just committed the change in rev 39304 so there's no need. BTW, tvb_get_bits is already exported in trunk. I scheduled both 39304 (str_to_str) and 38301 (tvb_get_bits) to be backported to 1.6.3. (07 Oct '11, 07:00) JeffMorriss ♦ If the answer is good, please mark it as so by checking it. (07 Oct '11, 07:07) grahamb ♦ Thanks for the help! (07 Oct '11, 11:21) redraymon |
Does the error remain if you use MSVC2008 (EE is fine) in stead? Last I checked, 2008 is still the Windows toolchain used for official builds.
Haven't tried with 2008. Don't have a copy and haven't looked for it. If it hinders me then I may try that road but I've built the dissector and essentially have worked around these two functions.
Just found it odd that it would not recognize one function but would be fine with other functions in the same header.
Are you building your dissector as part of the core Wireshark or a plugin? If you are building it as a plugin, have you compiled Wireshark at least once? Furthermore, are you sure that you are compiling using the correct CRT? MSVC2010 defaults to
v100
, but official versions of Wireshark (e.g. from the Downloads page) currently usesv90
.Building it as a plugin. I'm using v100 and everything compiles and runs correctly, unless I try to use this one function.
I know that it isn't the same CRT but I'm unsure of why certain functions from a header file would link when one or two don't.