Archived

This topic is now archived and is closed to further replies.

paulbird

dynamic and static libraries. Help!

Recommended Posts

Hello, I am told by my compiler's handbook that you can either use dynamic libraries which saves space because all your programs can use them or static libraries built into your program - but it doesn't seem to tell me how to do that? Does anyone know how to use static libraries? So that I can send people quick programs without having to send them all the libraries to go with it? P.S I am using Borland C++ [edited by - paulbird on May 28, 2003 11:47:59 AM]

Share this post


Link to post
Share on other sites

#pragma comment(lib, "mylib.lib")


[edited by - pag on May 28, 2003 11:49:44 AM]

Share this post


Link to post
Share on other sites
On windows you can build two different versions of your libraries - static and dynamic. The static library is a lib file. The dynamic library will be a dll and will have a lib file produced with it. This lib file is different to the lib file you get when you build a static library.

When you build an application that uses your library you can choose to use the static or the dynamic version. To use the static version you link with the static lib file. To use the dynamic library you link with the other lib file; when you run the program it will try to find the dll.

So build your library as a static lib file and link to it and your friend won''t need any dlls.

Share this post


Link to post
Share on other sites