How to use FFTW DLL import library .lib as a static .lib in my project?

牧云@^-^@ 提交于 2020-07-21 07:38:48

问题


I've knowledge of C++ and compiling small plug-ins (always based on a similar and laid out workflow). Though currently I need to compile the latest version of FFTW into a static library (or get it from the compiled version which should supposedly be a lot easier) and it's giving me an insanely hard time. Probably because I don't know the ins and outs of compiling. As a note I'm working on Windows with Visual Studio.

Since I really want to know how this should work I'm asking the question here.

Basically I need a static .lib of fftw3f library on Windows that I can include in another Visual Studio project.

The first I did was download the 64 bit dll's of FFTW from the website (hoping I could use this). http://www.fftw.org/install/windows.html

Then I've done the accompanying step they stated, that is: Run the following in lib.exe.

 lib /def:libfftw3-3.def
 lib /def:libfftw3f-3.def
 lib /def:libfftw3l-3.def

I've done this as well and got a .lib file that I could use in my project correctly. I've been able to compile my project, yet the output build apparently dynamically linked to the library instead of including it as a static library.

I'm compiling my project to .dll but require the fftw3f library to be statically included in my output.

Using lib.exe /list libfftw3f-3.lib I was able to find out that the lib file was referencing the libfftw3f-3.dll.

According to my google results this would mean the .lib file that I created is a DLL import library instead of static library.

It's hard to figure out how to phrase my question because I'm not sure what the terminology is and what's going on behind the scenes. I guess:

  • How can I use the libfftw3f-3.lib file created from lib.exe as a static library in my own project. So that it is included in my output .dll instead of dynamically linked?

Based on what I learn from comments/answers I'll be happy to update/edit/rephrase my question to make more sense for most other users as I'm likely way of with the terminology


回答1:


You cannot expect to convert a DLL into a static library.

In order to create a static library you need to re-compile the library from its source code, with an output target that is a static library. If you cannot obtain the source code, then your goal cannot be achieved.



来源:https://stackoverflow.com/questions/21265217/how-to-use-fftw-dll-import-library-lib-as-a-static-lib-in-my-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!