Re: mono embedding in c++: how to get a array from C# code?

sunsflower <[email protected]>
Newsgroups gmane.comp.gnome.mono.general
Message-ID <[email protected]>
//I reckon that mono_field_get_value will return a MonoArray,
//Try something a bit like this:
//
//MonoArray* monoArray = NULL;
//mono_field_get_value(obj, field, monoArrayl);
//MonoString *monoString = mono_array_get(monoArray, MonoString *, 0)
//char *s = mono_string_to_utf8(monoString); // copy this into a buffer that
you manage
//mono_free(s);

and how can I pass a pointer to mono?...
<code>
stuct test
{
        int index;
        string name;
};


MonoMethod* method = mono_class_get_method_from_name(klass, "testfunc", 2);
MonoException* ex;
typedef int(__stdcall *func)(MonoObject*, test*, MonoException**);
func f1 = (func)(mono_method_get_unmanaged_thunk(method));
test t1;
</code>
something like this? but C# won't accept a pointer except in unsafe context.
is there some other way of doing this - to read from a pointer to a struct
in C# and change it? or should I just pass the struct as a value?



--
View this message in context: http://mono.1490590.n4.nabble.com/mono-embedding-in-c-how-to-get-a-array-from-C-code-tp4666903p4666907.html
Sent from the Mono - General mailing list archive at Nabble.com.
_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.