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

VB-Calls-Fortran

pierangelo_f_
Beginner
385 Views
I am tring to run the sample C:\Program Files (x86)\Intel\Compiler\11.0\074\fortran\Samples\Fortran\MixedLanguage\VB-Calls-Fortran but I get the error System.BadImageFormatException.

In the ouput windows of the IDE I see:

'VBCallsFortran.vshost.exe' (gestito): caricato 'C:\Windows\assembly\GAC_64\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll', nessun simbolo caricato.
'VBCallsFortran.vshost.exe' (gestito): caricato 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\8.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll', nessun simbolo caricato.
'VBCallsFortran.vshost.exe' (gestito): caricato 'C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', nessun simbolo caricato.
'VBCallsFortran.vshost.exe' (gestito): caricato 'C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll', nessun simbolo caricato.
'VBCallsFortran.vshost.exe' (gestito): caricato 'C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll', nessun simbolo caricato.
'VBCallsFortran.vshost.exe' (gestito): caricato 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\8.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll', nessun simbolo caricato.
'VBCallsFortran.vshost.exe' (gestito): caricato 'C:\Program Files (x86)\Intel\Compiler\11.0\074\fortran\Samples\Fortran\MixedLanguage\VB-Calls-Fortran\VBCallsFortran\bin\VBCallsFortran.vshost.exe', nessun simbolo caricato.
'VBCallsFortran.vshost.exe' (gestito): caricato 'C:\Windows\assembly\GAC_MSIL\mscorlib.resources\2.0.0.0_it_b77a5c561934e089\mscorlib.resources.dll', nessun simbolo caricato.
'VBCallsFortran.vshost.exe' (gestito): caricato 'C:\Windows\assembly\GAC_64\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll', nessun simbolo caricato.
'VBCallsFortran.vshost.exe' (gestito): caricato 'C:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll', nessun simbolo caricato.
'VBCallsFortran.vshost.exe' (gestito): caricato 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualBasic\8.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualBasic.dll', nessun simbolo caricato.
Il thread 0xdc terminato con il codice 0 (0x0).
Il thread 0x17c4 terminato con il codice 0 (0x0).
'VBCallsFortran.vshost.exe' (gestito): caricato 'C:\Program Files (x86)\Intel\Compiler\11.0\074\fortran\Samples\Fortran\MixedLanguage\VB-Calls-Fortran\VBCallsFortran\bin\VBCallsFortran.exe', simboli caricati.
Eccezione first-chance di tipo 'System.BadImageFormatException' in VBCallsFortran.exe
Eccezione non gestita di tipo 'System.BadImageFormatException' in VBCallsFortran.exe

Informazioni aggiuntive: Tentativo di caricare un programma con un formato non corretto. (Eccezione da HRESULT: 0x8007000B)

Il programma '[5908] VBCallsFortran.vshost.exe: Gestito' terminato con il codice 0 (0x0).
0 Kudos
1 Reply
Steven_L_Intel1
Employee
385 Views
The problem is that the VB.NET application is targeted to "Any CPU" but the Fortran DLL, by default, builds as IA-32. If you run this on an x64 system the VB.NET code runs in x64 and it cannot call a 32-bit DLL.

I have seen one recommendation to go into the Advanced properties of the VB project and change the target processor to x86. I think it should also work to create a new build configuration for x64, but one of my colleagues said that did not work for him.
0 Kudos
Reply