GNU GCC *.lib file usage or conversion for WIN32

I have the following code that I'm trying to get to work with the GNU compiler (3.x):
http://code.axter.com/leaktracker.h

This works just fine with VC++ and Borland.  To get it to work with Borland, I used a conversion progran that converted MS Lib file to a lib file compatible with Borland.

I'm looking for a tool that can help me make a similar conversion for the GNU compiler.

Does any one know of a tool or a method to get either MS Lib files or Borland Lib files to work with the GNU 3.x compiler, or a method to convert the file to something GNU can use?

Does the GNU compiler have anything similar to a *.lib file in Windows?

Using the GNU compiler, when you create a static DLL in windows, does it create just a *.a file, or both *.a and *.dll file?
If it creates both, then does the *.a file work like a *.lib file, and is it needed at runtime?
LVL 30
AxterAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cwwkieCommented:
> I'm looking for a tool that can help me make a similar conversion for the GNU compiler.

Looks like reimp could do this: http://jrfonseca.planetaclix.pt/projects/gnu-win32/software/reimp/
more info: http://www.mingw.org/mingwfaq.shtml#faq-msvcdll

But you can also put the functions from the dll in the imports section of a def file. afaik that would work in all three compilers.
0
AxterAuthor Commented:
>>But you can also put the functions from the dll in the imports section of a def file. afaik that would work in all three compilers.

I'm already doing that.  How would that help me with GNU compiler?
0
cwwkieCommented:
Excuses, seems I made a wrong assumption. I thought gcc also would accept a .def file as input, but it seems you need to create a .lib file...
0
AxterAuthor Commented:
After much Google searching, I found the solution.  I'm adding this information here so if anyone else is looking for it, they'll know how to do it.

I need to make a *.a, which is similar to the *.lib files for MS and Borland.
To make a *.a file I used the dlltool which comes Dev-C++.  Actually, it probably comes with the GNU compiler, but I haven't verified that yet.

Example command line use:
dlltool --output-lib leaktracker_gcc.a --input-def leaktracker.def --dllname leaktracker.dll

Important note here, don't use a full directory path for the DLL, like the following:
dlltool --output-lib leaktracker_gcc.a --input-def leaktracker.def --dllname c:\windows\system32\leaktracker.dll

This will produce a *.a file that looks for DLL named cwindowssystem32leaktracker.dll

What I had to do was temporarily copy the DLL to the local directory in which I was creating the *.a file.
To simplify things, I copied the *.def file to the local directory as well.

That gave me a leaktracker_gcc.a file which I'm able to use with the GNU g++ compiler.
Example:
g++ test.cpp leaktracker_gcc.a

The DLL doesn't have to be in the system to compile the above test.cpp file, but it does need to be accessable when running the executable.


0
GranModCommented:
Closed, 500 points refunded.
GranMod
The Experts Exchange
Community Support Moderator of all Ages
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.