[Mono-list] How to call managed from unmanaged code?

Holger Arnold harnold@gmx.de
Mon, 2 Sep 2002 16:04:03 +0200


Hello,

I know that P/Invoke is the standard way to call unmanaged functions from 
managed code. But what is the standard way to do call managed code from 
unmanaged code? 

(1) The MS.NET documentation describes how I can use a delegate as a 
parameter to a P/Invoke call, which is then marshalled to a native function 
pointer on the unmanaged side? Is this functionality already fully 
implemented in Mono? 

(2) What if a marshalled delegate is called asynchronously, after the call 
which originally transported the delegate to the unmanaged side returned? Is 
it safe to call into a running Mono runtime from a different thread?

(3) Are there any other (possibly Mono-specific) mechanisms to call from 
unmanaged to managed code, assuming that both are running within a single 
process?

Regards,
Holger