Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
34 lines (26 sloc) 544 Bytes
/*
Test your installation by running:
clang -o sample -fblocks sample.c -lBlocksRuntime && ./sample
The above line should result in:
Hello world 2
If you have everything correctly installed.
*/
#ifndef __BLOCKS__
#error must be compiled with -fblocks option enabled
#endif
#include <stdio.h>
#include <Block.h>
int main()
{
__block int i;
i = 0;
void (^block)() = ^{
printf("Hello world %d\n", i);
};
++i;
void (^block2)() = Block_copy(block);
++i;
block2();
Block_release(block2);
return 0;
}
Something went wrong with that request. Please try again.