开发者

How to build LibXtract as DLL on Windows

开发者 https://www.devze.com 2023-04-03 10:33 出处:网络
Nowdays I\'m just trying to use some audio libraries, and the LibXtract is one of them. With the help of gcc, I built LibXtract as static library and everything went ok :)

Nowdays I'm just trying to use some audio libraries, and the LibXtract is one of them. With the help of gcc, I built LibXtract as static library and everything went ok :)

But when I tried to use the lib in MSVC, I met a problem : since the lib static format is not compatible between gcc and MSVC, I just tried to compile the LibXtract into DLL(shared) format开发者_开发知识库, but even I set the configure flag(--enable-shared), the library was still compiled into static format ...

Does anyone knows something about this ? Or you can give me a better way to achieve the goal(using LibXtract in MSVC)? Thanks very much :)


I've searched the LibXtract codes and found that there seems no dll-output codes in it, so I think that LibXtract may be just can be compiled into static format now, otherwise you have to modify the library codes...(not so sure)

Now I just copied the original codes and config.h which is generated by sh ./configure operation to a new VC-Static-library project, also I modified many codes(most are cast operations) to fit the VS compiler,and at last I got the LibXtract.lib, but I'm not so sure about the correction ... But the simple test program seems to be OK :)

And about the topic which was mentioned by Andy T(Thank you for your comments :)), he said that the static library which is built in mingw can be linked in MSVC, I've tried and found at least two things which will cause the conclusion fail:

  1. if the static library is compiled in standard-C, there will be almost OK in most of time, since the format of .a and .lib seems the same, but when you called some functions which is not supported in MSVC,there will be unreferenced problem ...

  2. if the static library is compiled in standard-C++, there will be more problems, the obvious one is the name mangling, since the name mangling operations are very different between gcc and MSVC, this will cause a lot of unreference problem when linking ...

0

精彩评论

暂无评论...
验证码 换一张
取 消