Fortran and c++

Fortran and c++

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

7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I just installed g77 (gnu fortran 77) and tried that. Works much better. Must be an incompatability between the Fortran and C++ libraries

Jim

Whose C++ compiler are you using?

Steve

Steve - Intel Developer Support

Hi Steve,

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

Jim

Well, this is venturing into unknown territory for me, but I'd suggest trying the Intel C++ compiler and see what happens.

Steve

Steve - Intel Developer Support

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++.

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

Leave a Comment

Please sign in to add a comment. Not a member? Join today