I wrote a DLL for windows in fortran language, using the DEC directives:
!DEC$ ATTRIBUTES DLLEXPORT, STDCALL :: SOLVER
!DEC$ ATTRIBUTES ALIAS:'SOLVER' :: SOLVER
because I want to call it from a vb.net program. From the program in vb.net, the DLL is called with:
Public Declare Auto Sub SOLVER Lib "solver.dll" _
(ByRef N As Double(,), ByRef V As Integer(,), ByRef C As Integer(,), ByRef car As Double(,), _
ByRef E As Double, ByRef ni As Double, ByRef ro As Double, ByVal U As Double(,), _
ByRef Nmax As Integer, ByRef Cmax As Integer, ByRef IERR As Integer)
I'm using Intel Composer XE 2011. Under "Properties/Fortran/Runtime libraries" I set "Multithread DLL (/libs:dll /threads)", and "Use Intel Math Kernel Library" is set to "Sequential (/Qmkl:sequential)" because I need Lapack routines.
I compile in "Release", with no manifest (I tried also with it, same error). The compiled DLL is in the same directory of the vb.net EXE, and I have already put all the libraries requested by "Dependency Walker" for the solver.dll in the same dir.
I get the sollowing error when I try to run the vb.net code (in Release, debug target for "Mixed Platform" or "Any CPU" with "x86" directive):
Microsoft Visual C++ Runtime Library
An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information.
and then the program stops and gives me the error:
Impossibile caricare la DLL 'solver.dll': Routine di inizializzazione della libreria di collegamento dinamico (DLL) non riuscita. (Eccezione da HRESULT: 0x8007045A).
that translated to English it is more or less: "Impossible to load the DLL 'solver.DLL': Initialization routine of the dynamic link library (DLL) not successful (Exception from HRESULT: 0x8007045A)."
Please help, I cannot solve this.