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

ifx dll will not load - System.BadImageFormatException

JamesDilworth
Beginner
390 Views

Hello,

 

I have been trying to get my code to compile with the ifx compiler. I am compiling it to a .dll and then importing that in VB and calling one simple function as a test.

 

When I use the ifort compiler (also with x64), the code compiles, and the function can be read in vb.

 

When I use the ifx compiler (with the same settings), the code compiles, but the VB code throws this error: System.BadImageFormatException: 'An attempt was made to load a program with an incorrect format. (0x8007000B)'

 

I understand that this error normally comes from a mismatch between architecture (x64/x86), but can see from DUMPBIN /headers that the dll is 64-bit, as is my VB (note it was able to read the ifort x64 dll).

 

I have also tried making a much reduced version (my full project is ~100,000 lines) with just the simple function and some libraries I have written. This version compiles fine, is read by the VB and returns the correct value from the simple function.  I have used DUMPBIN /imports on this and I can see that this reduced dll imports the same .dlls as the full project, so that suggest runtime libraries are not the issue. I could start building up the code from this reduced version up to the full program, but that will be very difficult. 

 

Would anyone have any suggestions as to what to check? I am running with /warn:interfaces, and the only warnings I am getting are to do with importing internal symbols and jump from outside a block.

 

I am using Intel Fortran Compiler 2025.2.0 [Intel(R) 64].

 

--EDIT----

Sorry, I have realised this is the same problem as discussed in this other post. Adding /Qipo also worked for me. 

Intel oneapi 2025.0: "Bad image" error with DLL in Visual Studio Project 

Regards,

James

 

 

0 Kudos
0 Replies
Reply