[fpc-devel] OSX: Setting up parameters to objc_msgSend()
pascaldragon at googlemail.com
Sat Oct 13 09:40:50 CEST 2018
Dmitry Boyarintsev <skalogryz.lists at gmail.com> schrieb am Sa., 13. Okt.
> On Fri, Oct 12, 2018 at 6:48 PM Sven Barth via fpc-devel <
> fpc-devel at lists.freepascal.org> wrote:
>> Not quite: the Boolean16, Boolean32 and Boolean64 types were introduced
>> because the libraries provided by GTK required a 4-Byte boolean type that
>> worked like Object Pascal's Boolean.
> That's interesting.
> Let me ask a couple of things here:
> 1) gboolean is a size of int (
> where FALSE is 0 and TRUE is not FALSE.
> so, it's more -1, rather than 1 and it doesn't quite maps to Boolean
> and/or Boolean32. It's matches to LongBool.
> b : Boolean;
> lb : LongBool;
> b32 : Boolean32;
> b := true;
> lb := true;
> b32 := true;
> writeln(byte(b),' ',LongWord(b32),' ',LongWord(lb));
> writeln(ord(b),' ',Ord(b32),' ',Ord(lb));
> Results in:
> 1 1 4294967295
> 1 1 -1
> (matches documentation)
This was the reason they were added:
> 2) why the were they named booleanN rather than gtkboolean or something?
> (I'm referring to the suggestion of using objcbool name. It seem to fit)
They're an extension of the existing Boolean type with merely a different
size, so why should they be named any differently? (in addition to what
>> Then maybe it's an issue about the ABI (maybe all values with a size < 4
>> need to be correctly extended due to the ABI).
> I think Jonas clearly stated that ABI call works properly (to the word of
> the specification)
> The issues is that BOOL in objective-C is for Intel (macOS) is not _Bool
> but rather a signed char.
> As of today, Pascal doesn't provide Boolean type that behaves like a
> signed char in ABI terms.
> (Boolean, and Boolean8 are size of _Bool which matched the size of signed
> char, though treated are passed as "_Bool" following ABI rules)
Then maybe the type used to represent that BOOL should be a "type char"
alias instead of using one of the build in Boolean types.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-devel