We help IT Professionals succeed at work.

Using Lib files in C++

niffasmiff asked
Just returning to C++ after a long while in the wilderness.

Have downloaded a set of API functions that have been implememnted in a DLL with a corresponding lib file.

I have managed to include the lib file in my project, but when I try and compile I get the following error message:

[LinkerError] 'C:\MSSDK\ICQMAPI.LIB' contains invalid OMF record, type 0x21.

Does this mean the lib file is corrupted or have I not included it correctly. I looked at borland's help file and it suggested to add the file to the ALLLIB variable and its path to the LFLAGS variable of the make file.

Can anybody tell me what I am doing wrong?

I am using a very old version of Borland C++ builder (well version 3!), which may affect this.
Watch Question

Note that, C++ Builder doesn't understand  the import library of VC++. Therefore, you need
rebuilder the import library from dll. Borland provides the utility "implib" for that job.

            implib -a ICQMAPI  ICQMAPI.dll
            implib  ICQMAPI  ICQMAPI.dll

The above command will produce ICQMAPI.lib that can work with C++ Builder

Moverover, if ICQMAPI wrote for C, you need something like

extern "C"
    #include    ....    //  header files of ICQMAPI



Borland Implib Version 3.0.8 Copyright (c) 1991, 1999 Inprise Corporation

Syntax: IMPLIB [options] libname[.lib] [@respfile | srcname] [srcname ...]
   -a     Add '_' alias for MS flavor cdecl functions
   -c     Case sensitive symbols
   -f     Force imports by name (with hints)
   -w     No Warnings

Respfile may contain a list of source files to process.
Wildcards are ok for .DLL and .DEF file names.


I followed your advice and used the implib function... and managed to create a new Lib file. However, when I tried to compile again, it errored with the following:

[LinkerError] Unresolved external 'ICQAPICall_SetLicenseKey(char*,char*,char*) __stdcall' referenced from C:\ICQPRJ\UNIT1.OBJ.

Unit 1 being the module I was calling it from, set license key being the function.

I would appreciate some further help, if that is OK, otherwise I will let you have the points!!!!
I don't have  the ICQ library, therefore I can not know what happend.
Do you test both cases :

1/     implib -a ICQMAPI  ICQMAPI.dll
            after that ,  try to link with C++ Builder Project, if not success ,
            recreate library in next  case

2/      implib  ICQMAPI  ICQMAPI.dll


Have tried it with every single possible option and it is still coming up with the error! Think I may try and re install msvc++ and try again! But thanks for your help anyway.

I almost think the program will work with

        implib  ICQMAPI  ICQMAPI.dll
Forget my previous message, I posted it before I read your reply.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.