I have been given a fortran dll created by a coworker to use in my c# app. the dll was compiled as 32 bit dll and the function i desire has been exported. i confirmed the export using DUMPBIN /EXPORTS my.dll and the function i want to use is listed.
When I try to call the function i get an exception: BadImageFormatException - an attempt was made to load a program with an incorrect format.
My application has been compiled with VS 2010 as 32 bit but I am running on Windows 7 64 bit. Below is my c# code:
static void Main(string args)
double p = (double)2500.0;
double t = (double)950.0;
short b = (short)1;
float h = FortranWrapper.ENTPT(ref p, ref t, ref b);
[DllImport("My.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern float ENTPT(ref double Pa, ref double Tx, ref short b);
I did NOT install the Fortran development environment but the runtime libs located here:
I have used the DependencyWalker to verify I have the required files and it looks pretty good. I am only mission 2 files: GPSVC.DLL and IESHIMS.DLL
but these are missing for applications that work so i don't think it is a problem.
I know very little about fortran but need help getting this working. its probably something stupid that i am doing but i cant find it.
Sorry for posting again....The first post didn't show up so I am reposting.
Thanks in advance for any help!!