Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use tlib.exe for Win32 application using Borland C++ 4.5?

Status
Not open for further replies.

Sjhaw

Programmer
May 14, 2011
9
US
Is the 32 bit .LIB created in a very similar way that the 16 bit .LIB is created?

tilb.exe takes the object files (.obj) and put them into a .lib file.

Borland C++ 4.5 allows the creation of 32 bit .obj files using BCC32 (bcc32 -c -r- -w- -WC example.c). But how to create 32-bit .LIB file? Is there a tlib32.exe? I do not find any tlib32.exe.

Thanks for your assistance.
 
LIB Files are just a collection of OBJ files contained within a single file. The only difference between a "32 bit" LIB file and a "16 bit" LIB file will be in the OBJ files, not the LIB file itself. The TLink program takes the OBJ files in the LIB file and Links the appropiate OBJ files together to make an executable (EXE, DLL, COM).
 
Thanks, Prattaratt for your clear explanation.

>The only difference between a "32 bit" LIB file and a "16 bit" LIB >file will be in the OBJ files, not the LIB file itself.
In other words, I can first use BCC32.exe for creating 32-bit .obj files and then use tlib.exe for putting these .obj files into a single .lib file.

For Win32, how about creating a single .dll file using Borland c++ 4.5? Is it better to use a .dll file? I find that tlink32 allows using .dll/.lib (implib.exe converts a .dll to lib).
 
>For Win32, how about creating a single .dll file using Borland c++ 4.5? Is it better to use a .dll file?
That depends on what you trying to accomplish. A LIB file is used strictly by the linker program to create an executable file, while a DLL IS an executable file. While you can link in DLL's to an executable file, you can also load DLL's dynamically at runtime as well; You cannot do that with LIB files.

> I find that tlink32 allows using .dll/.lib (implib.exe converts a .dll to lib).
Implib does not actually convert the DLL to a LIB file; it creates a LIB file that allows the linker to resolve calls to exported DLL functions. You need a 32 bit linker to create 32 bit DLL files. Think of it like this: LIB files are an intermediate step to creating an executable, similar to an OBJ file, while a DLL is a final product.

DLL files allow for flexible maintenance of your programs, as you can modify the internals of a DLL function call and the program won't care one whit, as long as the function's "signature" doesn't change. A function's signature consists of its name, number of parameters and types and return type. You do not have to relink your whole project, just the individual DLL, and every program that uses the changed functions will reflect those changes. If you change part of the code contained within a LIB file, you have to relink every program that uses the changed functions to a new version in order incorporate the changes.
 
Under 32 bit linking using tlink32 (Borland C++ 4.5) I get this error: " Unresolved external '__ hardretn' referenced from module tdrvtst.c (see link below to view this file) whereas under 16 bit linking using tlink, I do not get this error. How to solve this problem? Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top