Reputation: 1879
I have couple of lib files and I want to use in my project. How to build the C# Wrapper around C++ lib files.
Any weblink or any tutorial you know, please send me.
Thanks in advance.
Harsha
Upvotes: 2
Views: 665
Reputation: 41
After creating the C++ CLR class library.
You can also consume it using DLLImport
//c# code
[DllImport(@CPPProjectName, CallingConvention = CallingConvention.StdCall)]
public static extern void SendData(string args);
Invoke the method in normal way
SendData("data123");
Upvotes: 0
Reputation: 17624
Create a C++ CLR Class Library project, and then write a C++/CLI class which wraps the functions in your libs.
From C#, you can then add a reference to your class library, and call the class and its methods directly.
Upvotes: 7