Thorsten Schöning
Thorsten Schöning

Reputation: 3717

What's the difference between IMPLIB and MKEXP in C++Builder to create import libraries?

After asking how to use PathCchCanonicalizeEx with C++Builder 10.2, I was told to create missing import libraries using the tools IMPLIB or MKEXP. I've tested both apps and they are creating lib files based on KernelBase.dll of my Windows 10. Though, both file contents look different, they start with different headers, are differently large overall etc. MKEXP documents to Creates an import archive from an input file, but doesn't seem to explain what that actually means.

So, when to use which of the both tools? What is the difference in purpose, how they work, possibly what they do support, etc?

Upvotes: 1

Views: 932

Answers (2)

c.fogelklou
c.fogelklou

Reputation: 1801

IMPLIB is for generating a 32-bit import lib for a DLL, for 32-bit Windows builds.

MKEXP is for generating a 64-bit import lib for a DLL, for 64-bit Windows builds.

The format created by IMPLIB is different than the format created by MKEXP, and the correct format is needed for the 32-bit and 64-bit linker tools in Borland to understand them. The lib itself simply loads the .DLL when your app starts so doesn't include anything else other than "load DLL and link the internal static functions to the ones in the DLL"

Using RADStudio 11, I found I had to use the -a flag for 32-bit importing OpenSSL, like this:

REM convert_openssl_libraries.bat
REM convert the 32-bit .lib libraries with -a flag to 
REM add the '_' at the beginning of the function names

implib -a libssl-3.lib libssl-3.dll
implib -a libcrypto-3.lib libcrypto-3.dll
implib -a legacy.lib legacy.dll

REM convert the 64 bit .a libraries

mkexp libssl-3-x64.a libssl-3-x64.dll
mkexp libcrypto-3-x64.a libcrypto-3-x64.dll
mkexp legacy-x64.a legacy-x64.dll

Upvotes: 0

Remy Lebeau
Remy Lebeau

Reputation: 596186

IMPLIB is for generating an import lib for a 32bit DLL.

MKEXP is for generating an import lib for a 64bit DLL.

Upvotes: 3

Related Questions