Hi,
I'm attempting to use an existing C++ codebase from a C# application. At
certain times I need to let the unmanaged code notify the managed code (via
a callback) that an event has occurred.
After having read a few articles on the subject I came up with the following
piece of code. I'm not sure if this is the right way to do things, however,
as several of the examples I found online were written using the old C++
managed syntax (using __event and __gc) and I wanted to use the newest
syntax.
So, now I'm turning to you guys for advice. The code below works without any
problems, but I want to know if it is even remotely correct (and by correct,
I mean in accordance with the best practice approach):
Unmanaged C++ code:
http://blacksmith-studios.dk/csharp/Foo.h
http://blacksmith-studios.dk/csharp/Foo.cpp
Managed C++ code:
http://blacksmith-studios.dk/csharp/WrapperLib.h
http://blacksmith-studios.dk/csharp/WrapperLib.cpp
C# code
http://blacksmith-studios.dk/csharp/Main.cs
I've used the following article as a heavy reference:
http://www.codeguru.com/cpp/cpp/cpp_...cle.php/c6867/
Thanks!