Linking with Borland C

Jeffrey Russell Horner jhorner@cs.utk.edu
Wed Sep 16 21:23:00 GMT 1998


>Hi folks,
>
[ my mailer complained of 8 bit stuff so I deleted this line ]
>
>> 
>>  Hello,
>> 
>>  I'm more or less aware of the troubles linking gcc DLL's using
>> VC++. I am trying to use a gcc DLL created with the dllhelper utility in a
>> program that's compiled using Borland C and I'm having a lot of problems.
>> 
>>  1) Is there any known solution to this problem? 
>
>	There was a method noted here in the last couple of weeks on how to 
>generate MS compatible .dlls using Gnu-Win32, that had been tested.  You 
>might want to take a look at the archives for the information.
>
>	In terms of Borland C, it has always been able to understand the MS 
>.dll.  So, if you generate a .dll that MSVC can understand, then Borland C 
>can probably understand it as well.
>
>>  2) If it not possible the dynamic linkage, can I get some kind
>> of static library (such as .lib) out of gcc, so I can link it using
>> Borland C?
>
>	Afaik, you can not generate .lib files easily via Gnu-Win32.  As far as 
>linking is concerned, I believe that Borland/Win32 only recognizes the MS 
>and Borland type .lib files.  You would probably be best served by generating 
>an MS compatible .dll to use with Borland.

I have been successfull in building libraries with gnuwin32 gcc and
linking them with various NT compilers: VC++, Intel's c compiler,
Watcom C/C++.  However, since I don't have a Borland compiler I've
never tested linking with it.

One is able to do this since gnuwin32 gcc uses the COFF object format,
the same one used by most (the ones I've listed above) NT compilers.
The trick to getting gcc-compiled libraries or objects to link with NT
libraries or objects is this:  You Must Use The Correct Calling
Convention, e.g., symbol names, caller or callee cleans up stack, etc.

I don't know if this discussion is relevant to the list, but you can
email me if you need more help.

****************************************************************
Jeff Horner        The University of Tennessee     CS Department
423 974-2841            fax: 423 974-8296         104 Ayres Hall
http://www.cs.utk.edu/~jhorner/        Knoxville, TN  37996-1301              
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list