[cpp] Re: 有没有工具把COFF格式的.lib文件转成ELF格式的.a文件?或从.DLL导出.a导入库?
lijie
cpunion at gmail.com
Sun Aug 20 02:53:36 CST 2006
在 06-8-19,lijie<cpunion at gmail.com> 写道:
> 我不知道这个问题问得是否正确。有一个是用VC6以上版本编译的,包括一个DLL和一个.LIB文件,有没有办法让它在mingw的gcc编译器中使用?或者你有其它简单的办法可以让gcc编译器使用这个DLL。
>
找到了一个方法:
1、pexports test.dll > test.def
2、dlltool --dllname test.dll --def test.def --output-lib libtest.a
3、ranlib libtest.a,这一步不知道什么作用。
生成.a文件正常,不过测试时外部变量有一些问题:
Info: resolving _cTest by linking to __imp__cTest (auto-import)
fu000001.o:(.idata$2+0xc): undefined reference to `libtest_a_iname'
fu000002.o:(.idata$2+0xc): undefined reference to `libtest_a_iname'
nmth000000.o:(.idata$4+0x0): undefined reference to `_nm__cTest'
collect2: ld returned 1 exit status
查看libtest.a文件,发现有符号__libtest_a_iname,没有libtest_a_iname;符号_nm_cTest不存在。
More information about the Cpp
mailing list