关于.dll.a文件的几个小知识点

来源:互联网 发布:微商用什么软件 编辑:程序博客网 时间:2024/06/08 18:00

(1)

http://old.nabble.com/libstdc%2B%2B.dll.a:-No-such-file-or-directory(gcc-4.4.0)-td27186916.html

 

libstdc++.dll.a: No such file or directory(gcc-4.4.0)

 

Because d:/msys/mingw/lib/gcc/mingw32/4.4.0/libstdc++.dll.a does not exist. 

Try to hack d:/msys/mingw/lib/gcc/mingw32/4.4.0/libstdc++.la and change 

library_names to an empty string

 

 

(2)

http://www.cublog.cn/u1/52454/showart_1280627.html

 

This should create libACE.dll (the Win32 shared library) and libACE.dll.a (the Win32 import library for the DLL). 

 

 

(3)

http://www.cygwin.com/cygwin-ug-net/dll.html#dll-build

 

However, if you are building a dll as an export library, you will probably want to use the complete syntax:

 

gcc -shared -o cyg${module}.dll /

    -Wl,--out-implib=lib${module}.dll.a /

    -Wl,--export-all-symbols /

    -Wl,--enable-auto-import /

    -Wl,--whole-archive ${old_libs} /

    -Wl,--no-whole-archive ${dependency_libs}

The name of your library is ${module}, prefixed with cyg for the DLL and lib for the import library. 

Cygwin DLLs use the cyg prefix to differentiate them from native-Windows MinGW DLLs, see the MinGW website for more details. 

${old_libs} are all your object files, 

bundled together in static libs or single object files and the ${dependency_libs} are import libs you need to link against, 

e.g '-lpng -lz -L/usr/local/special -lmyspeciallib'.

 

 

(4)

http://zhangyafeikimi.javaeye.com/blog/404580

 

 

有了dll文件需要导出def文件: 

pexports zlib1.dll > zlib1.def 

 

有了dll和def文件,需要导出MinGW的.a文件: 

dlltool --dllname zlib1.dll --def zlib1.def --output-lib libz.dll.a 

 

有了dll和def文件,需要导出一个VC的lib文件: 

lib /machine:i386 /def:zlib1.def 

 

注意: 

C++的dll不具有2进制级别的共享性,也就是说VC的MinGW的C++ dll不能混用。 

而C的可以。 

pexports和dlltool的MinGW的工具,lib是VC的工具。