我正在尝试一个简单的程序,通过 dll 访问 C# 程序中的 C 函数,
class DllImportTest
{
[DllImport("TestApp.dll", EntryPoint = "main1")]
public static extern void main1();
}
class Program
{
static void Main(string[] args)
{
DllImportTest.main1() ;
}
我看过代码,函数名是对的。我也尝试过使用 Extern "C"但是,它的 .C 文件会给我一个错误。 我已将 .Dll 放在 C# 可执行文件夹中。 我在这里做错了什么吗?
最佳答案
找到了! 我不得不将 Extern "C"与 __declspec(dllexport) 结合使用。我从来没有一起使用过,谢谢大家
关于c# - "Unable to find an entry point named"在 c# 中使用 C dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11356606/
相关文章:
css - 高度 :100%; works, 但最小高度 :100%; doesn't work?
.net - String.GetHashCode() 的复杂性
google-apps-script - 将使用 google apps 脚本构建的图表插入到 go
rest - 使用 Twitter 的 REST API 从收藏夹获取 faved_at 日期?
svn - Hudson - SVN 错误 : org. tmatesoft.svn.core.SV
jquery-ui - jQuery UI 日期选择器。显示一种格式,保存其他格式