C++ DLL

  • Thread starter Thread starter Tim
  • Start date Start date
T

Tim

Hello All,
I am trying to import a DLL file (written in C++) into a
C# project.
I used the DllImport[] and it builds, but when I run it I
get the following error: "Unable to find an entry point
named Open in DLL Test.dll". 'Open' is the name of the
function located in the dll. It is also a member of the
CTest Class (CTest::Open).
Does anyone know why I'm getting this error? I'm
relatively new at this and I have no idea what to do
next. I did create the DLL file as well. Could the
problem be located there?
Thanks in advance for all you help,
-Tim
 
Most likely your dll is not exporting the function 'Open' correctly. Right click the dll and select Show Dependencies or Quick View
and have a look at the functions it exports.
function located in the dll. It is also a member of the
CTest Class (CTest::Open).

I'm not expert on C but I think you don't want to have the function as part of a class. Code like this should be all you need

int __stdCall Open(int Param1, int Param2 ...)
{
return Param1+Param2;
}

then create a file called exports.def and put in it
Exports
Open

That's about all you need for it to work.

--
Michael Culley


Tim said:
Hello All,
I am trying to import a DLL file (written in C++) into a
C# project.
I used the DllImport[] and it builds, but when I run it I
get the following error: "Unable to find an entry point
named Open in DLL Test.dll". 'Open' is the name of the
function located in the dll. It is also a member of the
CTest Class (CTest::Open).
Does anyone know why I'm getting this error? I'm
relatively new at this and I have no idea what to do
next. I did create the DLL file as well. Could the
problem be located there?
Thanks in advance for all you help,
-Tim
 
Back
Top