I have a dll written in C++ running along in my exe and would like to
call an API from the dll into the managed code portion of my exe,
which is written in C#. I know that you can call a function in the C++
dll by using the DllImport statement and declaring a P/Invoke
compatible API signature for the managed portion to call into the
unmanaged portion. But can you do the reverse? Essentially, what I
want to do is have the C# section provide an particular function as a
callback to the C++ dll so when it is ready to perform a certain task,
it makes a call to the callback function provided in the C# section
(which can be made into a dll). Is this possible? If so, can anyone
give me suggestions on where to start?
Thanks in advance,
Justin
|