-
-
Notifications
You must be signed in to change notification settings - Fork 251
Open
Description
Note that there are no implicit conversions (except
to_unsafe, which is explained later) when invoking a C function: you must pass the exact type that is expected. For integers and floats you can use the variousto_...methods.
But this is not true:
lib LibC
alias Int = Int32
fun exit(status : Int) : NoReturn
end
LibC.exit(69_u8) # okay
LibC.exit(69_i128) # okayMore surprising is that it is okay to pass a BigInt here too, but not its unsafe counterpart:
require "big"
LibC.exit(69.to_big_i) # okay
LibC.exit(69.to_big_i.to_unsafe) # Error: argument 'x0' of 'LibC#exit' must be Int32, not Pointer(LibGMP::MPZ)So something else must be going on.
Metadata
Metadata
Assignees
Labels
No labels