Fortran DLL in C#?
-
I am trying to use a DLL which was originaly written in fortran. Allthough this DLL is suposed to be in C, a lot of its functions do not work in C# (some does). I believe it has fortran version as well as C version. Has anyone played with Fortran DLL in C#. I get the following errors during compilation. AccessViolationException BadImageFormatException DllNotFoundException YOu can go to this link http://www.originlab.com/index.aspx?s=8&lm=117&pid=251[^] download the "examples in zip form". They have a simple DLL,FortranDLL, which contains basic functions such as double SUMFT(double, double), which returns the sum of two doubles. Can any one make it work? What do i need to make it work?
-
I am trying to use a DLL which was originaly written in fortran. Allthough this DLL is suposed to be in C, a lot of its functions do not work in C# (some does). I believe it has fortran version as well as C version. Has anyone played with Fortran DLL in C#. I get the following errors during compilation. AccessViolationException BadImageFormatException DllNotFoundException YOu can go to this link http://www.originlab.com/index.aspx?s=8&lm=117&pid=251[^] download the "examples in zip form". They have a simple DLL,FortranDLL, which contains basic functions such as double SUMFT(double, double), which returns the sum of two doubles. Can any one make it work? What do i need to make it work?
I believe you can P/Invoke into most (all?) Fortran calls. Have you tried this? The Numerical Algorithms Group shows how to call their Fortran dll from C#[^], perhaps that will get you off to a good start. If this fails or doesn't work for certain calls, but you can access it via C++, you could write a C++/CLI (managed C++) dll that talks to the Fortran dll, then have your C# code talk to the C++/CLI dll. There are articles on this site that show you how to write simple C++/CLI dlls to call native code.
Life, family, faith: Give me a visit. From my latest post: "When Constantine severed the Hebrew origins of this faith in Messiah, a new religion was officially created. It is this religion that Orthodox Jews fear their relatives and friends becoming members of." Judah Himango