Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add a C++ DLL file in my .NET application?

Tags:

c#

How can I add a C++ DLL file in my .NET application?

like image 672
mony Avatar asked Feb 08 '10 17:02

mony


People also ask

How do I create a .NET DLL?

To create a DLL File, click on New project, then select Class Library. Enter your code into the class file that was automatically created for you and then click Build Solution from the Debug menu. P.S. DLL files cannot be run just like normal applciation (exe) files.


1 Answers

You would use an "extern" function, marked with the DllImport attribute.

[DllImport(@“C:\mylib.dll”)]
public static extern int myFunc(int param);
like image 190
John Gietzen Avatar answered Oct 12 '22 22:10

John Gietzen