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

Thread safe c# service using fortran dll

Fernando_Cosso
Beginner
625 Views
Hi all,

I have a c# windows service that starts a couple of threads and then each thread executes the same fortran function.

When that happen, the first function keeps running just fine, while the other one triggers a c# exception.

Is there any compiler option to fix that? I googled a lot and only find recursive and save. I have to test them in the office tomorrow, but I am not optimistic.

PS: The fortran code has modules

Thanks
0 Kudos
1 Reply
TimP
Honored Contributor III
625 Views
Declaring the Fortran function or subroutine as RECURSIVE would be an important step, which avoids the need to use one of the ifort options /Qauto or the like. SAVEd variables are incompatible with allowing each thread to have its own copy. It would also be important to clean up any undefined variables (often referred to as un-initialized, although technically I've been told that's not correct Fortran terminology).
0 Kudos
Reply