[Mono-dev] add_internal_call with int32[]

pierre pierre.saunier at ppmodeler.com
Mon Apr 30 15:17:11 UTC 2018


Yes, this is working...
but how can I do If I have an int32_t array in the embedder (on a 
linux64 system for example, where int is mapped to int64_t)?
or the opposite, If I have an int64_t array in the embedder (on a 
windows64 system where int is mapped to int32_t)?



On 30/04/2018 17:10, Jonathan Mitchell wrote:
>
> Try
>
> mono_add_internal_call("testObj::mono_testObj_fromInts(object,int[])", 
> mono_testObj_fromInts);
>
> It’s very handy to have some utility code to iterate over a managed 
> class and dump out the native method signatures.
> It can save a lot of time when you have complex signatures.
>
> Jonathan
>
>> On 30 Apr 2018, at 16:05, pierre <pierre.saunier at ppmodeler.com 
>> <mailto:pierre.saunier at ppmodeler.com>> wrote:
>>
>> Hi,
>>
>> I am having trouble with the following code:
>>
>>     [MethodImplAttribute(MethodImplOptions.InternalCall)]
>>         static extern private void mono_testObj_fromInts(object
>>     testObj, Int32[] from);
>>       public void fromInts(Int32[] from)
>>       {
>>         mono_testObj_fromInts(this, (Int32[])from);
>>       }
>>
>> and in the embedder:
>>
>>     mono_add_internal_call("testObj::mono_testObj_fromInts(object,int32[])",
>>     mono_testObj_fromInts);
>>
>>
>> when run, I got the error:
>>
>>     An exception was thrown when calling Script:Main:
>>     (System.MissingMethodException) Attempted to access a missing method.
>>     StackTrace:
>>       at (wrapper managed-to-native)
>>     testObj.mono_testObj_fromInts(object,int[])
>>
>> of course, if I change the mono_add_internal_call to use int[] it is 
>> working... but, if I do that, and if I have understood properly, on 
>> some systems, int is mapped to int32_t and on other to int64_t.
>>
>> How can I make the mono_add_internal_call to work with int or int32 
>> or int64?
>>
>>
>> Thanks,
>>
>> Pierre
>>
>>
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.dot.net <mailto:Mono-devel-list at lists.dot.net>
>> http://lists.dot.net/mailman/listinfo/mono-devel-list
>
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.dot.net
> http://lists.dot.net/mailman/listinfo/mono-devel-list


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dot.net/pipermail/mono-devel-list/attachments/20180430/e87baea0/attachment-0001.html>


More information about the Mono-devel-list mailing list