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

VS2012 plus Fortran XE 2013 SP1 - redistributables

Paul_C_5
Principiante
1.297 Visualizações

Hi

I have a C# console app calling a Fortran DLL.  Both are x64. (at least I thought so)

It runs fine on my PC but when I port it to another machine it falls over with Exception encountered An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B).

It seems when I examine the Fortran DLL with Dependency Walker that it's hoping to load c:\program files (x86)\common files\intel\shared libraries\redist\ia32\compiler\LIBIFCOREMDD.DLL etc.

how can I ensure that the correct 64 bit support is redistributed with the 64 bit Fortran dll...

I have checked the other posts on similar questions but it's not clear to me what I am missing.  

I am not even sure where to start looking :-}

Many thanks for your help!

Best wishes
Paul

0 Kudos
8 Respostas
Steven_L_Intel1
Funcionário
1.297 Visualizações

64-bit Windows will skip over the "wrong architecture" DLLs when searching PATH - 32-bit Windows will not. But I have seen that for managed code (.NET) applications that call native code DLLs, you must build the application to target a specific CPU type and not "Any CPU", or else you'll get problems like this.

Paul_C_5
Principiante
1.297 Visualizações

Brilliant - thanks Steve  I shall go through the many projects making this up to ensure we've not got any running as Any CPU.

Thanks

Paul

Paul_C_5
Principiante
1.297 Visualizações

Hi - I have ensured that every project in the solution is set to x64.  I am confused by the fact that the Fortran dll itself when loaded into Dependency Walker gives an error "Error: Modules with different CPU types were found." and highlights error occurring in the following nested list (the first item is my fortran dll)

d:\work\dds1202_icoasst\work\liverpoolbay64\bin\x64\debug\UNALINEA_OMI_FTNENGINE.DLL

    c:\program files (x86)\common files\intel\shared libraries\redist\ia32\compiler\LIBIFCOREMDD.DLL

        c:\program files (x86)\common files\intel\shared libraries\redist\ia32\compiler\LIBMMD.DLL

 

I can't figure out why DependencyWalker (64 bit) considers that UNALINEA_OMI_FTNENGINE.DLL refers to the ia32 redistributables?

Currently flummoxed.

Steven_L_Intel1
Funcionário
1.297 Visualizações

DependencyWalker, inexplicably, doesn't do what Windows does for DLL searches, so you should ignore those errors. I know that I got the "incorrect format" error until I explicitly set the architecture for the .NET application. Are you saying it still doesn't work?

Paul_C_5
Principiante
1.297 Visualizações

Yes I am :-) - in fact on the machine it fails on (I've got dependency walker on there now) the error when loading says the following cannot be found:

MSVCR110D.DLL
IESHIMS.DLL

Which is a bit odd...

 

Steven_L_Intel1
Funcionário
1.297 Visualizações

IESHIMS can be ignored. But the other one is important - it tells me that you've linked your DLL against the "Debug" runtime libraries, and that is not portable to another system. Rebuild in a Release configuration, or at least with the runtime libraries set to "Multithread" or "Multithread DLL".

Paul_C_5
Principiante
1.297 Visualizações

Oh my!  Steve, thank you so very much!  I had no idea that was the case - it all works beautifully now thank you.

Also, can I take this opportunity to say I have only recently joined this forum and had two questions answered with patience, courtesy and skill. This is all too rare an experience on the web so thanks Intel for a great and extremely useful forum.

Steven_L_Intel1
Funcionário
1.297 Visualizações

You're very welcome!

Responder