How to write my own wrapper in C#?
Asked Answered
T

3

5

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

Tamarah answered 14/4, 2009 at 21:58 Comment(0)
A
7

You can get a good start here:

Call Unmanaged Code. Part 1 - Simple DLLImport

Amphictyony answered 14/4, 2009 at 22:3 Comment(1)
Link is dead nowActinia
J
3

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.

Juncture answered 14/4, 2009 at 22:2 Comment(0)
P
1

here's how I do it Interop. It shows you how to do the simple cases (BOOL to bool) as well as a bit of a harder case (passing a struct with pointers to managed memory). Good luck.

Pepi answered 14/4, 2009 at 22:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.