[Mono-devel-list] Embedding Mono - MonoArray

Friedrich Priewasser priewasser at gmx.at
Sun Jun 6 16:37:57 EDT 2004


On Sun, 6 Jun 2004 11:29:26 +0200, Paolo Molaro <lupus at ximian.com> wrote:

> On 06/05/04 Friedrich Priewasser wrote:
>> Can anyone tell me how to create a MonoArray for simple types like int's
>> (for "complex" datatypes it allready works)?
>> I tried to invoke the C# method "public void DoSomething(int[] values)"
>> To do this i used the following code, but it didn't work
>> (mono_runtime_invoke caused an error):
>>
>> ...
>> array=mono_array_new(domain, mono_defaults.int32_class, 2);
>> mono_array_set(array,int,0,21);
>> mono_array_set(array,int,1,43);
>> params[0]=array;
>> desc = mono_method_desc_new (":DoSomething(int[])",TRUE);
>> method = mono_method_desc_search_in_class (desc, klass);
>> mono_runtime_invoke (method,NULL,params,NULL);
>
> You pass NULL as the 'this' pointer and from what you pasted
> DoSomething() is not a static method.
> More details than "it doesn't work" would also be needed if there are
> other issues.
>
> lupus
>

Oh, since I haven't copied the line "public static void DoSomething(int[]
values)", i have forgotten the static, but I tried the program using a
static method.
To the error: I don't realy have any further information, calling invoke
the program hangs. A month ago, when I tried this first, I got an error I
can't remember anymore, but since the last installation it only hangs.

friedl



More information about the Mono-devel-list mailing list