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

Local Fortran variable changes mid process while calling C# DLL

MatchID_Ash
Débutant
1 735 Visites

I have a C# dll which contains APIs to communicate with our company apps. I have created an additional static library in C++ CLI to consume these APIs through languages like native C++ and Fortran. The library works well with native C++ and most times with Fortran. However, some values change randomly over time in the Fortran code while running.  The values being exchanged are validated to be correct. The problem is with local Fortran variables. They change over course of execution.

0 Compliments
1 Solution
jimdempseyatthecove
Contributeur émérite III
1 682 Visites

Try: __declspec(dllexport) extern "C" double GetValue(...

Jim Dempsey

Voir la solution dans l'envoi d'origine

3 Réponses
jimdempseyatthecove
Contributeur émérite III
1 683 Visites

Try: __declspec(dllexport) extern "C" double GetValue(...

Jim Dempsey

jimdempseyatthecove
Contributeur émérite III
1 680 Visites

Also, Fortran does not support Structured Exception Handling. Thus the Fortran->C++ wrapper function should be compiled without SEH (though it can use SEH features).

Jim Dempsey

0 Compliments
MatchID_Ash
Débutant
1 615 Visites

Thank you Jim. The calling convention was the issue as you pointed out.

0 Compliments
Répondre