crystal-lang / crystal_lib

Automatic binding generator for native libraries in Crystal
138 stars 30 forks source link

Compiler complains of no `LibC::Bool` type #78

Closed stakach closed 1 year ago

stakach commented 1 year ago

The type is generated here: https://github.com/crystal-lang/crystal_lib/blob/d686bbac0fde83c31882b66ac669b8181795ab19/src/crystal_lib/type_mapper.cr#L45

This occurs on Debian Linux, not sure if LibC::Bool is missing for that platform in crystal or it's not something defined for any platform

stakach commented 1 year ago

ping @straight-shoota would PrimitiveType::Kind::Bool align to something like LibC::SizeT

straight-shoota commented 1 year ago

I think there is no dedicated bool type in classic C. It's just int. That's why LibC::Bool doesn't exist for any platform (only on windows there's LibC::BOOL).

So PrimitiveType::Kind::Bool should probably map to LibC::Int.