【发布时间】:2012-10-05 05:29:50
【问题描述】:
我尝试在我的 c# 控制台应用程序中绑定http://msdn.microsoft.com/en-us/library/ms235636.aspx 中显示的简单 c++ dll,但我在运行时在 dll 中添加一个 EntryPointNotFoundException。我的测试课是
namespace BindingCppDllExample
{
public class BindingDllClass
{
[DllImport("MathFuncsDll.dll")]
public static extern double Add(double a, double b);
}
public class Program
{
public static void Main(string[] args)
{
double a = 2.3;
double b = 3.8;
double c = BindingDllClass.Add(a, b);
Console.WriteLine(string.Format("{0} + {1} = {2}", a, b, c));
}
}
}
什么不正确?
【问题讨论】:
-
我猜你的 CallingConvention 不匹配。我还假设 MathFuncsDll.dll 没有将名为
Add的方法声明为可导出。
标签: c# dllimport entrypointnotfoundexcept