简体   繁体   中英

How to import .lib into .dll?

I'm trying to code a dll as a plugin for some system using C++. This plugin will make use of another library which is a .lib file and should output only one .dll file as a result. So I want this other .lib file included in my dll. There should be only one dll file and lib file should be included in it, so that I could include this dll file into the system as a one-file plugin. Is this possible and how?

I'm using Visual C++ 2010 Express.

Thank you.

Unfortunately, the VS linker doesn't have an option equivalent to ld 's --whole-archive which can be used to include an entire library.

Your best bet is to unpack the library and link in the resulting object files. You can use the librarian ( lib tool) for that. To list all members of the library, use lib /LIST . Object files have to be extracted one by one, using lib /EXTRACT:member .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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