[Mono-list] embedding mono and returning GList

Nils Andresen nils at nils-andresen.de
Sun May 22 07:34:21 EDT 2011


Hi,
I'd like to call a managed method from c which returns a GLib.List.
I seem to be unable to do this,  however..
my managed code looks like:

public GLib.List Test()
 {
         GLib.List list = new GLib.List(typeof(string));
         list.Append("eins");
         list.Append("zwei");
         list.Append("drei");
         list.Append("vier");

         return list;
 }

my unmanaged code looks like:

MonoObject *o = mono_runtime_invoke (method, instance, NULL, &ex);
GList *list = (GList *)o;
...

If you want to have a look at the full code please find it here:
http://bitbucket.org/nils.a/mono-c-interop-test

However, this seems not to work...
Can someone explain to me where my error lies?

Thanks,
Nils


More information about the Mono-list mailing list