berten01

berten01

  • NA
  • 1
  • 0

C# using C++ DLL

Mar 29 2004 4:23 PM
HI, I'm trying to use one function found in a DLL that I did using C++. THe method is pretty simple: __declspec( dllexport ) int Compute(int a, int b); where Compute is: int Compute(int a, int b) { return a+b; } (This method DLL is named CFct.dll) So when I'm trying to acces this DLL in C#, I'm doing this: public class UsingCFct { [DllImport("CFct.dll")] public static extern int Compute(int a, int b); } and in my Form I'm calling it like this: textBox1.Text = UsingCfct.Compute(2,4).ToString(); But everytime I do so, I get a " 'System.EntryPointNotFoundException' occurred in IndustrialisationCtrl.exe Additional information: Unable to find an entry point named Compute in DLL CFct.dll." So I'm not sure if it's my call to the Dll that is not OK, or my dll itself?? Can someone help me!!!

Answers (1)