Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Fortran and c++

galbja
Beginner
1,025 Views

Help!
I've got a c++ library I would like to access from Fortran. I created a simple wrapper in C++ for one of the classes I would like to access and buried the class/function access in there. I've got it linked up OK (had to link through C++ compiler) and am able to access the necessary class/function, returning the appropriate information. The problem is this: when the Fortran program hits the end statement, I am getting:

"** Address Error **
End of diagnostics"

error. I've run this thing through gdb and have determined the error is coming from std::ios_base::_M_call_callbacks(...).

I have commented out all references to my C++ routines yet I get the same error, without calling any C++ stuff. Looks like some generic C++ shutdown stuff is being called.

Is there anything I have to do to get the C++ stuff to behave correctly with Fortran?? I'm linking through the C++ compiler so all the default libraries are known (i get the Fortran default libraries through the -v option). Should I be doing this some other way??

I'm running Mandrake 9.1 and just downloaded the latest and greatest Intel Fortran compiler.

Thanks

James A. Galbraith
INEEL
galbja@inel.gov

0 Kudos
6 Replies
galbja
Beginner
1,025 Views
I just installed g77 (gnu fortran 77) and tried that. Works much better. Must be an incompatability between the Fortran and C++ libraries

Jim
0 Kudos
Steven_L_Intel1
Employee
1,025 Views
Whose C++ compiler are you using?

Steve
0 Kudos
galbja
Beginner
1,025 Views
Hi Steve,

I'm using the standard gcc 3.2.2 tht came with my Mandrake 9.1 distribution.

Jim
0 Kudos
Steven_L_Intel1
Employee
1,025 Views
Well, this is venturing into unknown territory for me, but I'd suggest trying the Intel C++ compiler and see what happens.

Steve
0 Kudos
TimP
Honored Contributor III
1,025 Views
I don't know about this specific problem. As Steve suggests, there are incompatibilities with g++ STL code. The ifc run-time is compatible with Dinkumware STL, not with libstdc++. g++ would not be able to link properly, if your ifc calls run-time functions, and you have used libstdc++. Likewise, as you apparently found out, ifc won't be able to link compatibly with c++ objects built against libstdc++.
0 Kudos
galbja
Beginner
1,025 Views
Thats what I configured - an incompatiblity between Intel and gnu. The gnu f77 (g77) is enough for what I'm doing right now. If I need more Fortran support or a better compiler I'll then try the Intel Fortran/Intel C++ combination.

Thanks for your help

Jim
0 Kudos
Reply