-
Managed and Unmanaged C
I'm writing a application in C# now.
I have an DLL that was writed in Visual C++, ofcourse, unmanaged C++ (Not .NET).
How do I use this file in C#?
All the functions on these DLL, needs Pointers and memory allocament, can't do this in C#, just if I configure them as Unsafe, and I don't want this.
Thanks everybody.
-
You can write a Managed C++ Wrapper. Write a C++.NET DLL that implements your interface using garbage collection and .NET classes. This DLL can handle all the memory allocation and casting neccessary between the C# call to the C++.NET wrapper and the C++.NET call to the original DLL.
If you have sourcecode of your dll, you can compile the unmanaged C++ source into the wrapper dll.
-
Ok, I got the idea.
Thanks for your help again :)