[Gambas-user] unsigned int datatype for external function
Demosthenes Koptsis
demosthenesk at gmail.com
Sun Jun 10 20:44:46 CEST 2018
Thanks Benoît !
On 06/10/2018 09:31 PM, Benoît Minisini wrote:
> Le 10/06/2018 à 17:38, Demosthenes Koptsis a écrit :
>> hello,
>>
>> i want to use an unsigned int in external function, which gambas
>> datatype should i use?
>>
>> Integer or Long?
>>
>> The range of values is 0 to 4,294,967,295
>>
>>
>> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>> .
>
> You must use the Integer datatype.
>
> Then if you want to get the real unsigned integer value, as there is
> no UnsignedInteger datatype in Gambas (sorry for that), you have to do
> this trick:
>
> Public Sub UnsignedIntegerToLong(X As Integer) As Long
>
> Return CLong(X) And (Lsl(1, 32) - 1)
>
> End
>
> Public Sub LongToUnsignedIntegerToLong(X As Integer) As Integer
>
> Return X
>
> End
>
More information about the User
mailing list