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

Calling Fortran DLL from C#

William_M_5
초급자
846 조회수

I know there are several articles around on this topic but my question is a little bit different.

 

I have some existing Fortran codes that I've been able to compile into DLL's and successfully [DllImport] and call in my C# code.  All works fine on my development machine.  In the debugger and out, release and debug, all are fine.

 

I have some colleagues that would like to use the software now.  One of them it works fine for.  He just so happens to have Composer 2011 installed just like I do.  He is running the compiled binaries I gave him though.  The other colleague does not have the compiler.  The C# code would error with:

 

"Unable to load DLL 'yourfotran.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"

when it came time to the [DllImport].  Eventually realized that he needed the run-time redistributable installed.  That got us past that issue but...

 

Now we are getting:

 

"An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"

 

I ended up putting some debugging statements in there to have him run it again and confirmed that the C# part is in fact running as a 32-bit process, just like on my machine.  I believe the Fortran Dlls are also 32 bit.

 

I create a simple Fortran-only console application with the source from the same Fortran library and it ran without an issue so I believe the run-time redistributable is ok.

 

At this point I'm totally out of ideas.

 

I would love to hear any help or suggestions anyone has.

 

Thank you,

Bill

0 포인트
2 응답
DavidWhite
소중한 기여자 II
846 조회수
Bill, Suggest you try dependency walker from dependencywalker.com to see what other DLL's may be missing from this machine. Regards, David
0 포인트
William_M_5
초급자
846 조회수
David, Thanks for the suggestion and I will definitely pursue it. (Takes a while to get IS to approve and implement changes around here) It may lead me to the right answer in locating an attempt to load the incorrect thing but the error I'm seeing leads me to believe that strictly speaking it isn't a case of something "missing". The first error certainly was. The second error implies that it is finding what it thinks it is looking for but is unable to load it for some reason. Thanks, Bill
0 포인트
응답