Wrapping unmanaged C++ with C++/CLI - a proper approach.
Posted
by
Jamie
on Stack Overflow
See other posts from Stack Overflow
or by Jamie
Published on 2011-01-10T00:07:33Z
Indexed on
2011/01/10
3:53 UTC
Read the original article
Hit count: 246
Hi there,
as stated in the title, I want to have my old C++ library working in managed .NET. I think of two possibilities:
1) I might try to compile the library with /clr and try "It Just Works" approach.
2) I might write a managed wrapper to the unmanaged library.
First of all, I want to have my library working FAST, as it was in unmanaged environment. Thus, I am not sure if the first approach will not cause a large decrease in performance. However, it seems to be faster to implement (not a right word :-)) (assuming it will work for me).
On the other hand, I think of some problems that might appear while writing a wrapper (e.g. how to wrap some STL collection (vector
for instance)?) I think of writing a wrapper residing in the same project as the unmanaged C++ resides - is that a reasonable approach (e.g. MyUnmanagedClass
and MyManagedClass
in the same project, the second wrapping the other)?
What would you suggest in that problem? Which solution is going to give me better performance of the resulting code?
Thank you in advance for any suggestions and clues!
Cheers
© Stack Overflow or respective owner