On Sun, 22 Apr 2012 01:54:17 +0200, Bernd wrote about [fpc-pascal]
header translation question: I need an int sized boolean:

>I have this from the GLIB heads:
>
>typedef int    gint;
>typedef gint   gboolean;
>
>Now I need a few packed records with such gboolean types in them. On
>my i386 I am now just using
>
>type
>  GBoolean = LongBool;
>
>Just to get something¹ up and running before the day was over.
>Unfortunately I cannot yet test this on 64 bit and I'm not a C
>programmer also. I assume on 64 bit architectures the int will be 64
>bit, is this correct?

No.

There should be one of two C macros defined by your 64-bit compiler:
__LP64__ or __LLP64__ . The first one implies that for 64 bits you use
"long int" and the second one implies that you use "long long int";
they also imply that all pointers are 64-bit.  Without any "long" prefix
an integer remains 32-bit.

GCC defines __LP64__ .  But an undecorated "int" declares a 32-bit
integer.

>I haven't found anything in the ctypes unit,
>should I use ifdefs to define my GBoolean or is there a more elegant
>one-liner to easily get such an integer sized bool?

Leave it as you currently have it.
-- 
Regards,

Dave  [RLU #314465]
=======================================================================
david.w.n...@ntlworld.com (David W Noon)
=======================================================================

Attachment: signature.asc
Description: PGP signature

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to