1 | // |
---|---|
2 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
3 | // See https://llvm.org/LICENSE.txt for license information. |
4 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
5 | |
6 | #include <stdio.h> |
7 | #include <Block.h> |
8 | |
9 | // CONFIG |
10 | |
11 | void callsomething(const char *format, int argument) { |
12 | } |
13 | |
14 | void |
15 | dispatch_call_Block_with_release2(void *block) |
16 | { |
17 | void (^b)(void) = (void (^)(void))block; |
18 | b(); |
19 | Block_release(b); |
20 | } |
21 | |
22 | int main(int argc, char *argv[]) { |
23 | void (^b1)(void) = ^{ callsomething(format: "argc is %d\n", argument: argc); }; |
24 | void (^b2)(void) = ^{ callsomething(format: "hellow world\n", argument: 0); }; // global block now |
25 | |
26 | dispatch_call_Block_with_release2(block: Block_copy(b1)); |
27 | dispatch_call_Block_with_release2(block: Block_copy(b2)); |
28 | printf(format: "%s: Success\n", argv[0]); |
29 | return 0; |
30 | } |
31 |