chacko
asked on
Why LINK.EXE does not generate proper lib & exp files?
My platform is MSVC++ and have a frontend. One of our DLL (backend) is created in Borland C++. We asked the programmers to give the library file of the DLL so that we can link with our front end. But during linking we get an error 'aaa.lib - file is invalid or corrupted.'. So I decided to create the lib file from the Dll by using LIB application which came with MSVC++. The command I used is LIB /DEF:AAA.DLL. It created a lib file and an exp file. But it does not have any information. I mean exported functions. So while linking the frontend application is giving unresolved externals. How can I create a lib/exp file so that it does have all exported functions? Am I missing any command line parameter here? Mine is a 32 bit system.
Borland and Microsoft linkers generate different lib files. The problem is name mangling that is different for these linkers. If you want to use borland DLL with MFC EXE you can only export global functions and variable declaring then as extern "C" to avoid name mangling.
ASKER
Galkin,
Thanx for the answer. But I was expecting something more than that. All the functions are in C only. But I was not not able to create the import library file. I solved the problem this way. I created a module definition file with all the functions I wanted to import. Then I used command LIB /DEF:aaa.def which created the import library file. We can get a list of the functions which are exported with the application DUMPBIN /EXPORTS aaa.dll.
with thanks
Varghese
Thanx for the answer. But I was expecting something more than that. All the functions are in C only. But I was not not able to create the import library file. I solved the problem this way. I created a module definition file with all the functions I wanted to import. Then I used command LIB /DEF:aaa.def which created the import library file. We can get a list of the functions which are exported with the application DUMPBIN /EXPORTS aaa.dll.
with thanks
Varghese
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.