c++curlc++builderlibcurlc++builder-xe

How to solve linker error "LIBCURL.LIB contains invalid OMF record, type 0x21 (possibly COFF) " in C++Builder?


I am getting a linker error while trying to use libcurl in Embarcadero C++ Builder XE:

[ILINK32 Error] Error: 'C:...\CURL-7.52.1\BUILD\WIN32\VC8\DLL RELEASE\LIBCURL.LIB' contains invalid OMF record, type 0x21 (possibly COFF)

I have built the curl-7.52.1 library in Visual Studio 2005.

I am able to get libcurl.dll and libcurl.lib after building.

I tried a sample project in VS 2005 and I am able to execute it.

But I want to use libcurl in C++Builder instead.

If I use the same library built in VS 2005 in my C++Builder project, it is giving me the linker error.

Can you please help me? How can I use the libcurl library in my C++Builder project?


Solution

  • C++Builder's .lib file format (OMF) is different from MS Visual Studio's format (COFF). You should be able to make a compatible .lib file from the DLL using C++Builder's IMPLIB command-line utility:

    implib.exe -a LIBCURL_BCB.LIB LIBCURL.DLL
    

    And then add this LIBCURL_BCB.LIB file to your project instead of the .lib file you got when compiling libcurl in VC++.

    The -a switch is used to generate underscores for __cdecl functions.

    On my computer, I have only C++Builder 5, and its implib.exe is found in this folder:

    C:\Program Files (x86)\Borland\CBuilder5\Bin\