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

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 ...

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();

permanent link
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 ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×193
×25
×7
×2

question asked: 27 Oct '11, 21:52

question was seen: 2,997 times

last updated: 28 Oct '11, 03:01

p​o​w​e​r​e​d by O​S​Q​A