iOS lock step keyboard + metal
This commit is contained in:
17
examples/96-objc-block-capture.sx
Normal file
17
examples/96-objc-block-capture.sx
Normal file
@@ -0,0 +1,17 @@
|
||||
// A capturing closure rides through `xx ... : Block` and the
|
||||
// captured state survives across the call. The block's sx_env field
|
||||
// holds the closure's env pointer; the invoke trampoline restores it
|
||||
// before delegating.
|
||||
|
||||
#import "modules/std.sx";
|
||||
#import "modules/std/objc_block.sx";
|
||||
|
||||
main :: () -> s32 {
|
||||
x : s64 = 42;
|
||||
y : s64 = 100;
|
||||
cl := () => { print("x + y = {}\n", x + y); };
|
||||
b : Block = xx cl;
|
||||
invoke_fn : (*Block) -> void = xx b.invoke;
|
||||
invoke_fn(@b);
|
||||
0;
|
||||
}
|
||||
Reference in New Issue
Block a user