[Gambas-user] unsigned int datatype for external function

Demosthenes Koptsis demosthenesk at gmail.com
Sun Jun 10 19:27:12 CEST 2018


i dont understand,

i have an external function from libc and i see size_t as datatype.

size_t is unsigned integer

on function declaration what should i set for size_t, AS Integer or AS Long?

for example i have this

'void setbuffer (FILE *stream, char *buf, size_t size)
Public Extern setbuffer(stream As Pointer, buf As Pointer, size As 
Integer) 'FIXME size_t int or long?


On 06/10/2018 07:45 PM, Jussi Lahtinen wrote:
> So, it's 32bit integer. Most likely the library reads only 32 bit from 
> the memory, and thus "long" wont help you.
>
> Gambas integer reserves one bit for sign and thus returned values are 
> not correctly displayed in Gambas side.
> However you can display them correctly by using binary representation.
>
>
> Jussi
>
> On Sun, Jun 10, 2018 at 6:38 PM, Demosthenes Koptsis 
> <demosthenesk at gmail.com <mailto:demosthenesk at gmail.com>> wrote:
>
>     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
>     ]----
>
>
>
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20180610/ec03a903/attachment-0001.html>


More information about the User mailing list