[英]Calling C/C++ Code from C# .NET application
I have a c++ application, i need to call it's class methods from C# app 我有一个C ++应用程序,我需要从C#应用程序中调用它的类方法
I have followed the following tutorial and created a DLL file for the C++ app 我已按照以下教程进行操作,并为C ++应用程序创建了一个DLL文件。
http://msdn.microsoft.com/en-us/library/ms235636.aspx http://msdn.microsoft.com/en-us/library/ms235636.aspx
When i tried to add a reference for the DLL file it gives me error message 当我尝试为DLL文件添加引用时,出现错误消息
a reference to could not be added please make sure that the file is accessible and that it is a valid assembky or COM component
You cannot add an unmanaged DLL as a reference. 您不能添加非托管DLL作为参考。 What's more, you cannot consume C++ classes from an unmanaged DLL in C#. 而且,您不能使用C#中非托管DLL消耗C ++类。 Here are your options: 这是您的选择:
Of these options, the first is usually to be recommended. 在这些选项中,通常推荐第一个。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.