This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Linker error

0

Hello,

I have a function called catch_first_filtered_pkt() inside main_filter_toolbar.c. This should be called from inside wireshark/epan/dfilter/dfvm.c 's any_test(dfilter_t *df, FvalueCmpFunc cmp, int reg1, int reg2) function block. I've encountered a Linker error LINK2019:unresolved external symbol _catch_first_filtered_pkt inside dfilter.lib. How can i solve this error? Please Help.

This question is marked "community wiki".

asked 27 Oct '11, 21:52

Terrestrial%20shark's gravatar image

Terrestrial ...
96212829
accept rate: 42%

Creating library libwireshark.lib and object libwireshark.exp dfilter.lib(dfvm.obj) : error LNK2019: unresolved external symbol _catch_first_filtered_pkt r eferenced in function _any_test libwireshark.dll : fatal error LNK1120: 1 unresolved externals NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN \link.EXE"' : return code '0x460' Stop. NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN \nmake.exe"' : return code '0x2' Stop.

(27 Oct '11, 23:11) Terrestrial ...

One Answer:

0

Hurray!! I have resolved this by myself!!(though solution is somewhat silly ;-))

I have created a structure called xyz which has a function pointer called fp_catch_first_pkt inside epan/dfilter/dfvm.h.I have exported it using WS_VAR_IMPORT. I have assigned the address of catch_first_filtered_pkt() to it inside main_filter_toolbar.c file. Finally, i'm able to call the function this way:

xyz.fp_catch_first_pkt();

This answer is marked "community wiki".

answered 27 Oct '11, 23:56

Terrestrial%20shark's gravatar image

Terrestrial ...
96212829
accept rate: 42%

edited 27 Oct '11, 23:57

I presume that if xyz.fp_catch_first_pkt is null you don't call through it?

Otherwise, this will probably crash in TShark, which includes libwireshark (hence the code in epan/dfilter/dfvm.c) but does NOT have any toolbars (hence doesn't have gtk/main_filter_toolbar.c).

(28 Oct '11, 02:16) Guy Harris ♦♦

Ok! What would be the good solution to solve this linker error?

(28 Oct '11, 02:51) Terrestrial ...

That depends on what the ultimate purpose of these changes is, especially if it's something that'd be useful in TShark as well.

(28 Oct '11, 03:01) Guy Harris ♦♦