Wireshark-dev: Re: [Wireshark-dev] make a extension for packet-sctp.c, meet a problem.
From: 黄登辉 <huangdenghui@xxxxxxxxx>
Date: Thu, 31 May 2012 17:50:49 +0800
Hi
   Thanks, yes,add all exported symbols in epan/libwireshark.def can fix my problem.
  
   Another problem,  i want to add a file named as sctp_packet_lost_stat_dlg.c in gtk directory, and add menuitem SctpPacketLostStat in Statistics.
in order to make this menuitem available, i make some change in menus.c, also modified gtk/Makefile.common to make sctp_packet_lost_stat_dlg.c be compiled in to
wireshark. like the following
WIRESHARK_GTK_SRC = \
    about_dlg.c    \
........
    summary_dlg.c    \
    sctp_packet_lost_stat_dlg.c \
..........

but i still get compile error

libtool: link: (cd .libs && gcc -DINET6 -D_U_="__attribute__((unused))" -g -O2 -Wall -W -Wextra -Wdeclaration-after-statement -Wendif-labels -Wpointer-arith -Wno-pointer-sign -Warray-bounds -Wcast-align -Wformat-security -I/usr/local/include -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -c -fno-builtin "wiresharkS.c")
libtool: link: rm -f ".libs/wiresharkS.c" ".libs/wireshark.nm" ".libs/wireshark.nmS" ".libs/wireshark.nmT"
libtool: link: gcc -DINET6 "-D_U_=__attribute__((unused))" -g -O2 -Wall -W -Wextra -Wdeclaration-after-statement -Wendif-labels -Wpointer-arith -Wno-pointer-sign -Warray-bounds -Wcast-align -Wformat-security -I/usr/local/include -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -Wl,--as-needed -o .libs/wireshark wireshark-capture-pcap-util-unix.o wireshark-capture-pcap-util.o wireshark-cfile.o wireshark-clopts_common.o wireshark-disabled_protos.o wireshark-frame_data_sequence.o wireshark-packet-range.o wireshark-print.o wireshark-ps.o wireshark-sync_pipe_write.o wireshark-timestats.o wireshark-util.o wireshark-tap-megaco-common.o wireshark-tap-rtp-common.o wireshark-version_info.o wireshark-capture_errs.o wireshark-capture_ifinfo.o wireshark-capture_ui_utils.o wireshark-airpcap_loader.o wireshark-alert_box.o wireshark-capture.o wireshark-capture_info.o wireshark-capture_opts.o wireshark-capture_sync.o wireshark-color_filters.o wireshark-file.o wireshark-fileset.o wireshark-filters.o wireshark-g711.o wireshark-merge.o wireshark-proto_hier_stats.o wireshark-summary.o wireshark-tempfile.o wireshark-u3.o .libs/wiresharkS.o -pthread -Wl,--export-dynamic  -L/usr/local/lib gtk/libui.a gtk/libui_dirty.a codecs/libcodec.a wiretap/.libs/libwiretap.so epan/.libs/libwireshark.so wsutil/.libs/libwsutil.so -lpcap -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 -lm -lz -pthread -Wl,-rpath -Wl,/usr/local/lib
gtk/libui.a(libui_a-menus.o):(.data+0x20d0): undefined reference to `sctp_packet_lost_stat_cb'

Did i miss some steps to make thing right?

2012/5/30 Jeff Morriss <jeff.morriss.ws@xxxxxxxxx>
黄登辉 wrote:
Hi
   I meet a problem, i define a global variable e.g. g_sctp_packet_analyzing_debug in packet-sctp.c, then we want to access it in tshark.c.
even make a statement in tshark.c, i still meet link error undefined reference to `g_sctp_packet_analyzing_debug. i know it should be linked with
packet-sctp.o, but seems that wireshark compile system don't generate object file packet-sctp.o, i am not familiar with wireshark compile system.
Any expert can help me this out? thanks.

Any symbols put in libwireshark (e.g., from packet-sctp.c) need to be exported by being listed in epan/libwireshark.def .  (That file used to be only for Win32, but now *NIX builds also use it.)
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
           mailto:wireshark-dev-request@wireshark.org?subject=unsubscribe