C++ event callback converted to c# events

Hi Experts,

I have a C++ callback interface (bunch of pure virtual functions in a class).  The c++ library is being instantiated in a c# class library now.

So naturally, I want to convert these "events" as c# events now.

My thinking is to create delegates in the wrapper library and convert them directly, firing them off to c#.

I know that on the C# side, if these events come from a different thread, I need to invokeLater.

Is there anything I could have done differently to make my life better here?  Looking for any great ideas at all...  :-)

Thanks,
Mike
LVL 1
threadyAsked:
Who is Participating?
 
jkrConnect With a Mentor Commented:
Maybe this article could indeed help to make things easier: http://www.codeproject.com/Tips/393817/Pass-Csharp-delegate-as-Callback-to-Cplusplus ("Pass C# Delegate as Callback to C++") - if you just pass the delegates to the C++ callback interface to be invoked from there, it should be a piece of cake.
0
 
threadyAuthor Commented:
I've got a bigger problem.  I'm trying to do this in my CLR class library.  I don't have the ability to add any C# classes to this implementation.  How can I fire off events in here?  Is there some other type of class that I can use in this context?  I don't even see how to do this at the moment...

Mike
0
 
threadyAuthor Commented:
I just clicked... I export these functions as in your link above.  Sorry about that!  :-)
Awesome.
0
 
threadyAuthor Commented:
Actually, this is for the exported DLL type of interop... I'm not sure this works for the CLR class library method...
0
All Courses

From novice to tech pro — start learning today.