[cfe-dev] "Blocks" runtime
Bill Bumgarner
bbum at apple.com
Thu Jun 11 16:21:53 PDT 2009
On Jun 10, 2009, at 6:02 PM, Chris Lattner wrote:
> Hi all,
>
> In case you didn't notice, we committed the source for the Apple
> "blocks" runtime here:
> http://llvm.org/svn/llvm-project/compiler-rt/
>
> We haven't had a chance to properly integrate it into a build system,
> the ultimate goal is to combine it with "compiler-rt" which is the
> clang "libgcc" replacement (which should also be coming at some point
> soon).
I threw together a Makefile and compiled/ran a simple "hello world"
block object on Linux. This is likely completely wrong on the
integration front, but it does work.
- check out compiler-rt into llvm/lib
- drop the attached Makefile into compiler-rt
- make
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: application/octet-stream
Size: 424 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090611/d5a01489/attachment.obj>
-------------- next part --------------
---
I tested it with the following simple example (re-typed because my
stupid VirtualBox based VM doesn't do networking with the host. Sigh):
#include <stdio.h>
int main(int argc, char **argv) {
void (^helloBlock)(void) = ^{
fprintf(stdout, "Hello World!\n");
};
helloBlock();
return 0;
}
Compile it with (from the llvm dir):
./Debug/bin/clang -fblocks hello.c -LDebug/lib -lBlocks
And:
% ./a.out
Hello World!
%
b.bum
More information about the cfe-dev
mailing list