[Mono-list] Embedding Mono

Jeremy jswigart at gmail.com
Fri Feb 2 12:53:08 EST 2007


I'm toying with embedding Mono, as per
http://www.mono-project.com/Embedding_Mono

I've gotten the example to work, however the example shows the case of a
returning mono string. I'm getting crashes in Mono when I attempt to define
additional functions for the assembly to call back into C with.

The example shows this

static MonoString *Sample ()
{
	return mono_string_new (mono_domain_get (), "Hello!");
}

which works fine, but I can't seem to get functions that take arguments working.

for example:

static MonoString* gimme2 (MonoString*a)
{
return mono_string_new (mono_domain_get (), "Hello!");
}

even though I'm not even using the parameter, simply defining this, adding
it just like mono_add_internal_call, and likewise in the assembly, I get a
crash in mono.

Is it possible for assembly->c functions to take parameters?

Further, if I try a variation that just returns an int

static int gimme2 ()
{
    return 10;
}

it crashes as well. I suspect I need to wrap even basic types somehow, but I
can't find any reference to this.

Any help greatly appreciated.

Thanks
Jeremy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20070202/6635f4c5/attachment.html 


More information about the Mono-list mailing list