Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

Traceback information when calling Fortran from C/C++

Darek
Beginner
5,516 Views

I have a Fortran static library project which is linked to C/C++ program (tried both, pure C and C++). My goal is to execute Fortran code from my C/C++ program and in case there is any error get the traceback information. I am using Visual Studio 2010 with Intel Visual Fortran Studio XE 2013 to build everything.

The problem is that when there is an error in the Fortran code my program crash (which is fine), but I can't get the traceback. However, when I invoke my subroutines from a Fortran program (the main program is a Fortran code), then I get traceback information.

The Fortran static lib is compiled with the following parameters (just the most important): /debug:full /Od /traceback /check:bounds /check:stack /libs:static /threads /dbglibs /c

I found in the documentation that I have to initialize the Fortran runtime library, so that Fortran error handlers are established. I added invocation of for_rtl_init_ in the main() of my C/C++ code, however this doesn't work. The documentation of the for_rtl_init_ subroutine says that it only assigns the Fortran error handlers for Linux and OS X. How can I do that for Windows?

0 Kudos
25 Replies
Steven_L_Intel1
Employee
1,151 Views

I'm getting an early error loading the FortranWrapper assembly, and I don't know the managed code environment enough to understand why. All of the projects built successfully, though there's a warning about a dependence on a nonexistent CSCInterfaces reference.

0 Kudos
Frank_F_
Beginner
1,151 Views

Steve,

I cannot reproduce the error loading the FortranWrapper. What is the excact error message?

The warning about the dependence on nonexistent CSCInterfaces reference could be ignored (caused somehow by copying the project). But in the attached file I have corrected it. Please replace the existing file.

Frank

0 Kudos
Steven_L_Intel1
Employee
1,151 Views

I figured out the error - it is the one explained here: http://blogs.msdn.com/b/keithmg/archive/2012/03/20/strong-name-validation-failed-exception-from-hresult-0x8013141a.aspx

I undid the delay loading of DLLs used in that project, and also removed the copy of the Intel Fortran libraries being linked against so that the current libraries were used. I can now reproduce the error and will see if I can figure it out. I have a guess....

0 Kudos
Frank_F_
Beginner
1,151 Views

Steve,

is there any new information available about the "system access violation when calling a FORTRAN subroutine a second or subsequent time".

Thank you!

Frank

0 Kudos
Steven_L_Intel1
Employee
1,151 Views

Sorry, no. My guess turned out to be incorrect. Still working on it.

0 Kudos
Reply