two static libraries
I am currently providing a static library using vs2008. I am in the process of building my static library. However, since I am using another static library is there a way that i package this as a single static library. The reason here is that they will be calling functions in my library that depend on that other s开发者_JS百科tatic library (.lib). I am not sure how to go about doing that and need some help with that.
Look under project properties | Configuration Properties | Librarian | General
Put the name of the library (.lib) file you want to add to your library under "Additional Dependencies"
You may also have to set the "Additional Library Directories" setting so that it can find the library.
Here is one way:
- Find out all the object files in the static library. That can be done by running the command
lib STATICLIB /list
- Extract each object listed. You must give the exact name from step 1 (
lib STATICLIB /extract:.\debug\foo.obj
) - You can then add all the objects extracted form step 2 into your library
VC++ includes a command line library manager called lib.exe. It can me used to combine both object files and library files into a single library.
It may not be relevant to your case, but in some cases combining a third-party library to your own and distributing that as a library rather than a final application, (or in the case of many open source licenses, the source), may contravene the license terms for that library. So apply some caution in such cases.
精彩评论