Thursday, July 30, 2009

How can i use third party library (.lib) file in a DOS C++ program using Borland Turbo C++ 3.1?

There are three things to do and a couple of points to check.





1). If the library is distributed in header and object code or as a premade .lib file, you'll need to simply include the header file in your project in appropriate places, add the object to a .lib file using tlib if needed, and add the library file in by the correct switch at link time.





2). Some .lib files will have a different format that isn't compatible with Borland products. These may be useful if source is included for the entire library. Otherwise, contact the vendor to get a compatible version or the source code to be compiled under your setup.





3). Some libraries are distributed as open source and must be compiled for use. Simply compile to object and then use tlib from Borland to create a new library file(.lib). Remember to include the correct header file(s) in any case.





The only other problems could arise from directory conflicts. Some libraries will need to be manually linked in with switches to use that particular file. Sometimes the header should be included using the double quotes and a filespec rather than by placing the new header in the include directory. Watch for naming conflicts, especially if using a C library since they weren't written using the new namespace standards. I hope this gets you going.


No comments:

Post a Comment