[Mono-list] Embedding Mono : Classes
robertj at gmx.net
Thu Jul 16 03:44:38 EDT 2009
Chris Howie wrote:
> On Wed, Jul 15, 2009 at 6:45 PM, Alex
> Kuster<x.passion.and.the.opera.x at gmail.com> wrote:
>> and, how do I take parameters in a internal function call ?
> It's no different from P/Invoke, if you are familiar with that. You
> are simply writing the P/Invoke target in your embedding app, instead
> of in a library. Read up on P/Invoke, it will be very useful
There are more or less subtle differences between p/invoke
1) marshaling does not take place, e.g. a managed "string"
must be declared as MonoString* in the icall signature.
2) struct return types are not supported.
3) when the icall is an instance method, the first
argument ("this") of the icall must be a MonoObject*.
Static methods does not have the "this" pointer.
public class Test
public extern void InstanceMethod(string s);
public static extern void StaticMethod(string s);
void InstanceMethod(MonoObject *this_ptr, MonoString *s)
void StaticMethod(MonoString *s)
mono_add_internal_call ("Test::InstanceMethod", &InstanceMethod);
mono_add_internal_call ("Test::StaticMethod", &StaticMethod);
More information about the Mono-list