Hi,
I have mixed mode dll, which contains files with managed objects written in
MC++, and files with regular "C" functions.
One of those functions receives function pointer as parameter. I want to
pass to it delegate to managed object method.
I know how to do it from C# - DllImport etc. I suspect I can declare "stub"
method using those attributes, so it will actually reference "C" method, and
call this stub, letting marshaler to do the job. This will require to make
this "C" function exported. Is there another way to do it without simulating
C# way ?

Signature
==============================
Alexander Arlievsky
sasha@mprest.com
"The best tools for debugging are brains"
==============================
Igal Ioffe - 26 Sep 2003 21:37 GMT
Hi Alex,
As far as I know - the official answer is no.
The method "similar" to c# method (that you don't want to use) can be
viewed here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cp
concallbacksample.asp
BUT, though bit controversal, there is a method, in such you
can switch between clr calling convention and other calling
conventions: http://www.codeproject.com/managedcpp/cbwijw.asp
Don't foget to keep the delegate reference alive ...
Also if it helps you, you can use the "#pragma managed/unmanaged"
directive
to break code into managed/unmanaged parts.
Igal.
> Hi,
> I have mixed mode dll, which contains files with managed objects written in
[quoted text clipped - 6 lines]
> this "C" function exported. Is there another way to do it without simulating
> C# way ?