如何在.NET应用程序中添加C ++ DLL文件?
You would use an "extern" function, marked with the DllImport attribute.
[DllImport(@“C:\mylib.dll”)]
public static extern int myFunc(int param);
Depending on the nature of the DLL, you can
Write a wrapper in C++/CLI .
如果它在COM中注册,您只需在Visual Studio中添加COM引用,Visual Studio将为您创建所有Interop 。
Assuming you use Visual Studio, in your Solution right click "references" and choose "Add Reference". Select your dll file.
In the classes that will use the dll, add : using MyLibrarysName;
then you can call the functions in that DLL using Mylibraryname.myfunction
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.