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

Miguel de Icaza miguel@ximian.com
04 Sep 2002 11:41:07 -0400


Hello!

> > > (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?
> >
> > See the document mono/docs/embedding-api, it describes a mechanism to
> > call methods in the CIL world from the C world
> 
> This is exactly what I was looking for, thank you. Is it possible to estimate 
> the overhead of mono_runtime_invoke() compared to a normal function call?

mono_runtime_invoke is a front-end to mono_compile_method, so it will
perform a method lookup and then invoke the function.  You could
probably make things faster by caching the return value yourself.  Look
at the source for it.