Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

linking non-c++ libs in Borland C++

Status
Not open for further replies.

aldous

Programmer
Jun 23, 2004
8
US
How do I add a new library to my link
(i.e. libgc2.a) so that my fortran will
talk with my C++
 
First of all: is that link file compatible with the C++ linker??? Otherwise it's a dead end.

Totte
Keep making it perfect and it will end up broken.
 
How does one know if an object file is compatible with
a linker? The fortran compiler is g77 from cygwin,
the C++ compiler Borland. Both are running on my windows
pc. The documentation for each says NOTHING, other than
I know that Borland writes about __stdcall, __fastcall, etc,
(which are designed for different calling stacks and protocols so that other languages CAN be called.)

My boss asked about creating Fortran DLLs that C++ calls
as an alternative. I'd also be interested in anyone's
advice on that.
 
Well, a DLL is called by asking the DLL to load and then asking for the named routines, the reply to that(those) question is an address which to call.

So, you has to define the Fortran routines in C++ in a compatible way (calling stack and such) and that should be it.

This means that the DLL-file is created alltogether in the Fortran compiler and the only information transferred to the C(++)-compiler is parameters, calling stack (the way parameters is transferred) and routine name.

Please bear in mind that i'm in no way an expert on DLL but that's how i've used it in the one project i've used DLL.

I hope this will get you closer to the target.

Totte
Keep making it perfect and it will end up broken.
 
cygwin is quite another operation system. Generally object code generated under such different systems is not portable.

Ion Filipski
1c.bmp
 
You have to know what format your object files are. If they're coff (very good chance that they are), you can use the borland tool coff2omf to convert the object files so that Borland can use them.

A programmer is a device for converting Coke into software.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top