Re: Common FFI declarations

  • From: Mike Pall <mike-1205@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Tue, 8 May 2012 19:04:48 +0200

Duncan Cross wrote:
> This reminds me of something: in the WIN32 API, and a few other APIs,
> the boolean type ("BOOL" in WIN32's case) is unfortunately not the
> same bit-width as the C99/C++ 'bool' type, so you have to use an
> integer type instead.

$ git log -1 | tail -1
    FFI: Allow 'typedef _Bool int BOOL;' to make Windows users happy.

'_Bool unsigned int' works too. But no other combinations.

And, yes, this will affect the return types, too. So you need to
replace all of those:
  if ffi.C.IsZoomed(w) ~= 0 then ... end
with:
  if ffi.C.IsZoomed(w) then ... end

It's up to the user to declare BOOL, so this change doesn't break
existing code. But we'll definitely need to get some agreement for
the common Windows FFI declarations.

--Mike

Other related posts: