入口点未发现异常 [英] Entry Point Not Found Exception
本文介绍了入口点未发现异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在C#项目中使用C ++非托管的DLL和我越来越想打电话,说该入口点无法找到函数时出错。
I'm trying to use a C++ unmanaged dll in a C# project and I'm getting an error when trying to call a function that says that entry point cannot be found.
public class Program
{
static void Main(string[] args)
{
IntPtr testIntPtr = aaeonAPIOpen(0);
Console.WriteLine(testIntPtr.ToString());
}
[DllImport("aonAPI.dll")]
public static extern unsafe IntPtr aaeonAPIOpen(uint reserved);
}
下面是该函数的DUMPBIN:
Here is the dumpbin for the function:
5 4 00001020 ?aaeonAPIOpen@@YAPAXK@Z
我改变了DLL进口函数[DllImport(aonAPI.dll,入口点=?aaeonAPIOpen)]
和函数[DllImport (aonAPI.dll,入口点=_ aaeonAPIOpen)]
和没有运气。
I changed the dll import to [DllImport("aonAPI.dll", EntryPoint="?aaeonAPIOpen")]
and [DllImport("aonAPI.dll", EntryPoint="_aaeonAPIOpen")]
and no luck.
推荐答案
使用undname.exe工具,该符号地还原到
Using the undname.exe utility, that symbol demangles to
void * __cdecl aaeonAPIOpen(unsigned long)
这使得适当的声明:
[DllImport("aonAPI.dll", EntryPoint="?aaeonAPIOpen@@YAPAXK@Z",
ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr aaeonAPIOpen(uint reserved);
这篇关于入口点未发现异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文