|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Unable to find an entry pointI am trying to call a function which exist in unmanaged dll (MFC) from a c# application. Here is the declaration in the unmanged code: extern "C" { _declspec(dllexport) void __cdecl SetEDocName(); } Here is the declaration in the c# code: [DllImport("C:\\EManaged.dll", EntryPoint = "SetEDocName", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] static extern int SetEDocName(); In run-time I get the error message: "An unhandled exception of type 'System.EntryPointNotFoundException' occured in EdmSetup.exe Additional information: Unable to find an entry point named 'GetEDocName' in DLL 'C:\EManaged.dll'. Can someone please advise ? thanks, Yoav. Hello, Yoavo!
Do you habe appropriate define for you function? lets assume that there are necessary define file "exports.def". Its contents are the following: EXPORTS SetEDocName @1 Then you set /DEF:"exoports.def" for the linker. Another way to check if dll is exporting this or that entrypoint, you can use Dependensy Walker. ( exe is called depends.exe ) Y> I am trying to call a function which exist in unmanaged dll (MFC) Y> from a c# Y> application. Y> Here is the declaration in the unmanged code: Y> extern "C" Y> { Y> _declspec(dllexport) void __cdecl SetEDocName(); Y> } Y> Here is the declaration in the c# code: Y> [DllImport("C:\\EManaged.dll", EntryPoint = "SetEDocName", Y> ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] Y> static extern int SetEDocName(); Y> In run-time I get the error message: Y> "An unhandled exception of type 'System.EntryPointNotFoundException' Y> occured Y> in EdmSetup.exe Y> Additional information: Unable to find an entry point named Y> 'GetEDocName' in Y> DLL 'C:\EManaged.dll'. Y> Can someone please advise ? Y> thanks, Y> Yoav. |
|||||||||||||||||||||||