Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write my own wrapper in C#?

Tags:

c++

c#

wrapper

In my other question, I've been trying to find someone who knows where to find free open source OCR library for C#. However, it seems there is only C++ library and obviously, C++ is not C#.

One of the responds suggested to write my own wrapper in C#. I have pretty much no idea how to do it, where to learn to do it, or what it actually is - except I believe it's calling C++ methods in dll by changed method calls, .. that's just assumption, indeed.

Please, help out one more newbie. Thank you

like image 653
Skuta Avatar asked Apr 14 '09 21:04

Skuta


2 Answers

You can get a good start here:

Call Unmanaged Code. Part 1 - Simple DLLImport

like image 143
Sunny Milenov Avatar answered Oct 06 '22 15:10

Sunny Milenov


If you're wrapping is very simple, you can get away with P/Invoke. If you actually want managed objects, your easiest solution is probably to write the wrapper in C++/CLI (formerly Managed C++), as that provides a full feature set for managed/unmanaged interop.

like image 28
Not Sure Avatar answered Oct 06 '22 14:10

Not Sure