Using unmanaged pointer to callback function on managed C++
问题 I am writing C++/CLI a wrapper for some C++ libraries (static .lib, no source code available) controlling Digital I/O pins on an industrial computer. My objective is to handle the events of the DIO pins on an existing C# application using .NET CLR. The only viable option I could think of is to use a delegate in C++/CLI to fire events when the pin state changes (informed by the existing lib), and then handle these events in the C# part. I have tried the basic functionality using simpler mock