5
Answers

C# EntryPointNotFoundException for calling fortran dll

Ask a question
irak

irak

19y
7.1k
1
hi all, i am trying to call a fortran dll from c# but i always get "EntryPointNotFoundException: Unable to find an entry point named sumdll in DLL sumdll.dll." exception no matter what i did in the DllImport fields like specifying EntryPoint, ExactSpelling, CharSet. i tried almost all possible combinations but i get the same error. i think it should have worked with default specifications, like [DllImport("sumdll.dll")] public static extern int sumdll(int a, int b, int d); despite that fact, i tried to get rid of the exception with playing the specifications but i couldnt. i am about to go crazy! here is the related part of my code; [DllImport("sumdll.dll")] //, CharSet = CharSet.Auto, ExactSpelling = true, EntryPoint="sumdll", SetLastError=true)] //ExactSpelling = false, CharSet = CharSet.Auto,EntryPoint="sumdll")], blah blah public static extern int sumdll(int a, int b, int d); private void button_Click(object sender, System.EventArgs e) { try { int ap = int.Parse(tbox1.Text) ; int bp = int.Parse(tbox2.Text) ; int dp = 0; userInterface.Form1.sumdll(ap, bp, dp); //sumdll(ap,bp,dp); tbox3.Text = dp.ToString(); } catch(Exception exc) { tbox3.Text = exc.ToString(); } } } please help me! halise

Answers (5)