Static library with dynamic dependencies

◇◆丶佛笑我妖孽 提交于 2019-12-24 04:38:11

问题


I have come across quite a few similar questions, however I didn't really get my answer.

So, I have an App.exe that depends on Static.lib, which in turn depends on a dynamic library Dynamic.dll. In Static.lib I link to Dynamic.lib import library. I do understand that now the App.exe has to have Dynamic.dll in it's directory in order to run successfully, however when I try to link the code I get an error that the App project can't find Dynamic.lib import library.

My question is, why does the App project have to link to Dynamic.lib import library when it is already linked in Static.lib?


回答1:


My question is, why does the App project have to link to Dynamic.lib import library when it is already linked in Static.lib?

At first, you need to generate your static library, so you compile with the shared library's header files and you link with the shared library.

Then to generate an .exe you compile with the static library's header files; Then you need to link with the shared library because some of the methods found in the static library are implemented in the shared library.



来源:https://stackoverflow.com/questions/25706318/static-library-with-dynamic-dependencies

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