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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to call/link Fortran from C++ Builder6 windows??

Status
Not open for further replies.

aldous

Programmer
Jun 23, 2004
8
US
I am attempting to write a gui for some Fortran code
using C++ Builder6 from Borland, running in the windows
environment. NO ONE ON EARTH (including Borland tech support) apparently knows how to do this. I'm using
cygwin's g77.exe, which I'm starting to wonder about
(it gives me a .o file, not a .obj like windows seems to
want). Also, I am adding an underscore to func/sub name
because I "heard" that fortran's name mangling is such.
So I have ALOT of questions and no answers.

What I've tried:
in my C++ code: extern "C" void myfort_(int&);
for Fortran: subroutine myfort (ik)
integer ik
....

g77 -c myfortfile.f
(gives a .o file)

I add the .o to my Project, try to compile.
I thought I needed a libg2c.a or something like that....
Borland says not.

PROBLEMS: the extern dcl causes 89 errors in my C++ program
and "function myfort_" not found
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top