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

calling fortran in c++ builder

Status
Not open for further replies.

aldous

Programmer
Jun 23, 2004
8
US
I am trying to call a fortran subroutine from
my windows c++ builder6 c++ code. I compiled
the fortran code with cygwin's g77 compiler, -c,
to give me a .o file. I added the fortran.o to
my "project". Then, I TRYED to put an extern C
dcl in for the fortran function, thinking I'd link
with g2c in C++. PROBLEMS

1. WHERE does the extern C go? Before WinMain()
and there are 89 regular C++ members not found

2. In some locations, this extern causes only
one error "my_fortran_fun_() not found" in the
link stage.

DOES ANYBODY KNOW HOW TO GET THE C++ TO CALL
THE FORTRAN CODE CORRECTLY. Borland says I shouldn't
even need to link a special library (like g2c) but if
I did, WHERE WOULD I ADD the -lg2c.

HELP leading to a solution would be rewarded with
gold bricks, if I had any...
 
you can't compille togever code in Windows with code in cygwin.

Ion Filipski
1c.bmp
 
I wondered about that when cgywin popped up in a bash
shell window. But I only got this env as an aside because
it was a free fortran compiler.

So, thank you, and I posted in the Fortran forum to find
a native windows Fortran77 compiler...

Does that also mean Fortran DLLs encompassing cygwin
g77 object code won't work either? (I'd guess, they won't
work either.)

 
All you should do is reading fortran documentation which comes with fortran compiler and see which one could be linked with Borland and Microsoft C++ and how. Borland and Microsoft C++ compilers do not contain such information.

Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top