[Gambas-user] unsigned int datatype for external function

Benoît Minisini g4mba5 at gmail.com
Mon Jun 11 15:46:49 CEST 2018


Le 11/06/2018 à 15:40, T Lee Davidson a écrit :
> It's not that I didn't believe you, Jussi. Hence, the reason I asked the question regarding how to handle a 32-bit integer
> stored in a 31+1 integer datatype. A question that you have now partially answered by example using Bin$().
> 
>> Private Extern TakeAndReturn(value As Long) As Long In "liblibTest"
> 
> It doesn't make any sense to pass a long to a function that is expecting 32-bit integer. And, of course, the function would not
> treat the most significant bit as a sign bit. So, passing a signed integer TO the function is no problem. But when receiving the
> return value FROM the function, it would be stored in a signed integer datatype. So then back to my question, how to handle an
> unsigned integer in a signed integer datatype?
> 
> Why not do:
> 
> Private Extern TakeAndReturn(value As Integer) As Long In "liblibTest"
> 
> 

See my answer in the same thred.

-- 
Benoît Minisini


More information about the User mailing list