function pointers and callbacks
This commit is contained in:
@@ -4,12 +4,22 @@ pass_alias :: func(value native.imported_int_alias) native.imported_int {
|
||||
return value
|
||||
}
|
||||
|
||||
double_value :: c_func(value c_int) c_int {
|
||||
return value + value
|
||||
}
|
||||
|
||||
call_mapper :: func(mapper native.Imported_Mapper) c_int {
|
||||
return mapper?(21)
|
||||
}
|
||||
|
||||
main :: func() void {
|
||||
_ = native.imported_add(pass_alias(20), 22)
|
||||
_ = native.imported_scalar(3, 4)
|
||||
_ = native.child_value(7)
|
||||
_ = native.imported_read(native.imported_handle()?)
|
||||
_ = native.imported_string("hello")
|
||||
_ = native.imported_apply(double_value, 21)
|
||||
_ = call_mapper(double_value)
|
||||
_ = native.configured_value(9)
|
||||
signed i8 :: -2
|
||||
unsigned u16 :: 3
|
||||
|
||||
Reference in New Issue
Block a user