免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1767 | 回复: 1
打印 上一主题 下一主题

请教cygwin下wpcap的链接问题. 谢先 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-06-10 17:21 |只看该作者 |倒序浏览
gcc -Wall -Wno-format-zero-length -o demo_test  -lpthread -lwpcap demo_test.o
demo_test.o:demo_test.c:(.text+0x4ab): undefined reference to `_pcap_sendpacket'
demo_test.o:demo_test.c.text+0x611): undefined reference to `_pcap_next_ex'

demo_test.o:demo_test.c:(.text+0x9b5): undefined reference to `_pcap_open_live'
demo_test.o:demo_test.c.text+0xa50): undefined reference to `_pcap_compile'

demo_test.o:demo_test.c:(.text+0xa9f): undefined reference to `_pcap_close'
demo_test.o:demo_test.c.text+0xacf): undefined reference to `_pcap_setfilter'

demo_test.o:demo_test.c:(.text+0xb1e): undefined reference to `_pcap_close'
demo_test.o:demo_test.c.text+0xba9): undefined reference to `_pcap_close'

demo_test.o:demo_test.c:(.text+0xbf8): undefined reference to `_pcap_close



nm libwpcap的结果,可以看到Text段中有相关的接口.
d000010.o:
00000000 i .idata$4
00000000 i .idata$5
00000000 i .idata$6
00000000 i .idata$7
00000000 t .text
         U __head_wpcap_dll
00000000 I __imp__pcap_close
00000000 T _pcap_close


反汇编的结果比较奇怪:

00000000 <.idata$6>:
   0:    0a 00                    or     (%eax),%al
   2:    70 63                    jo     67 <_pcap_compile+0x67>
   4:    61                       popa   
   5:    70 5f                    jo     66 <_pcap_compile+0x66>
   7:    63 6f 6d                 arpl   %bp,0x6d(%edi)
   a:    70 69                    jo     75 <_pcap_compile+0x75>
   c:    6c                       insb   (%dx),%es:(%edi)
   d:    65 00 00                 add    %al,%gs:(%eax)

d000010.o:     file format pe-i386

Disassembly of section .text:

00000000 <_pcap_close>:
   0:    ff 25 00 00 00 00        jmp    *0x0
   6:    90                       nop   
   7:    90                       nop   
Disassembly of section .idata$7:

00000000 <.idata$7>:
   0:    00 00                    add    %al,(%eax)
    ...
Disassembly of section .idata$5:

00000000 <__imp__pcap_close>:
   0:    00 00                    add    %al,(%eax)
    ...
Disassembly of section .idata$4:

00000000 <.idata$4>:
   0:    00 00                    add    %al,(%eax)
    ...
Disassembly of section .idata$6:


[ 本帖最后由 傻旦 于 2008-6-10 17:51 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2008-06-10 22:28 |只看该作者
up一下
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP