Reputation: 7480
I've got a DLL that is written in C++ and I want to create a C# wrapper for it. I know this can be done, but I'm not sure how to go about this. I've got VS 2010 and I've been looking on the net, but not alot of clear definitions out there. For now, until I get he hang of it, my c++ DLL is pretty basic, as it only has functions that take in and return integers.
Can anyone provide an example, or point to a good place on the web?
Upvotes: 1
Views: 246
Reputation: 66604
You need to declare a (static) method with the extern
keyword to stand in for the native function and use the DllImport
custom attribute on it.
There is a tutorial on consuming unmanaged DLL functions on MSDN.
Upvotes: 2