Jump to content
  • Advertisement
Sign in to follow this  
nuclear123

How to statically link a dll/lib?

This topic is 2524 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Simple questions is how do i statically link a .lib file or .dll to my program in VS2010? im wanting to avoid having to haul the dll around! thanks

Share this post


Link to post
Share on other sites
Advertisement
.lib files are supposed to be linked by the compiler. They don't need to ship. VS2010 has a few ways to do that, in project's context menu there's project dependancies (link to .lib created by other projects in the same solution); in project's Property pages->Common Properties there are references. Again, I mostly use this to link to other projects in the same solutions.

To link generic .libs there is Property pages->Linker->Additional dependancies.
I am slightly inclined to an old method: #pragma comment(lib, yourLibFile) in the code. I like the advantage of noting dependancies in source, rather than in project settings.

As for dlls, it is required to rebuild them as .lib. They need to be shipped with the executable, no way around it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!