q66 / cffi-lua

A portable C FFI for Lua 5.1+
MIT License
181 stars 24 forks source link

Defining NDEBUG macro causes ffi.sizeof struct to return 0 #28

Closed danielga closed 3 years ago

danielga commented 3 years ago

Short background: remade the build system to work in conjuction with the rest of my system that builds Lua modules for a game. The build system for this game defines the macro NDEBUG for release builds.

While testing a build of this module with the NDEBUG macro, it was noticed that ffi.sizeof("struct something") was returning 0 (with this struct definition being struct something { int value; };). It will correctly return 4 if this macro is not defined. The host is a Linux x86_64 machine and it was built using GCC 9 (version doesn't matter).

I don't know if you will want to fix this issue but I'll use it as a heads-up for the future.

q66 commented 3 years ago

oops, definitely a bug :P thanks for reporting though

danielga commented 3 years ago

Thanks a lot!