简体   繁体   English

如何在Windows上将LibXtract构建为DLL

[英]How to build LibXtract as DLL on Windows

Nowdays I'm just trying to use some audio libraries, and the LibXtract is one of them. 如今,我只是尝试使用一些音频库,而LibXtract是其中之一。 With the help of gcc, I built LibXtract as static library and everything went ok :) 在gcc的帮助下,我将LibXtract构建为静态库,一切正常:)

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 ... 但是,当我尝试在MSVC中使用lib时,遇到一个问题:由于lib静态格式在gcc和MSVC之间不兼容,我只是尝试将LibXtract编译为DLL(共享)格式,但是即使我设置了configure标志(--enable-shared),该库仍被编译成静态格式...

Does anyone knows something about this ? 有谁知道这件事吗? Or you can give me a better way to achieve the goal(using LibXtract in MSVC)? 或者您可以给我一种更好的方法来实现这一目标(在MSVC中使用LibXtract)? 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) 我搜索了LibXtract代码,发现其中似乎没有dll输出代码,因此我认为LibXtract现在可能可以编译为静态格式,否则您必须修改库代码...(不是这样)当然)

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 :) 现在,我只是将通过sh ./configure操作生成的原始代码和config.h复制到一个新的VC-Static-library项目中,还修改了许多代码(大多数是强制转换操作)以适合VS编译器,最后我得到了LibXtract.lib,但是我不太确定该更正...但是简单的测试程序似乎还可以:)

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: 关于Andy T提到的主题(感谢您的评论:)),他说,可以在MSVC中链接在mingw中内置的静态库,我尝试过发现至少有两件事会导致结论失败:

  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 ... 如果静态库是用标准C编译的,则大多数情况下几乎都可以,因为.a和.lib的格式似乎相同,但是当您调用MSVC不支持的某些函数时,将会出现未引用的问题...

  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 ... 如果静态库是用标准C ++编译的,则会出现更多问题,一个明显的问题是名称处理,因为gcc和MSVC之间的名称处理操作非常不同,因此在链接时会引起很多未引用的问题。 。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM