Permalink
Browse files

Test block support

  • Loading branch information...
1 parent 5151341 commit 2b3c8ade7ae723885c0c234b62a0f4e1c38cc177 @pkhuong committed Oct 18, 2011
Showing with 12 additions and 0 deletions.
  1. +12 −0 test.c
View
12 test.c
@@ -24,6 +24,12 @@ int funcall_ptr (void ** ptr, int x)
return ((int(*)(int))ptr[1])(x);
}
+#include <Block.h>
+void * make_adder (int x)
+{
+ return Block_copy(^ (int y) {return x + y; });
+}
+
int main ()
{
vlbdb_unit_t * unit = vlbdb_unit_from_bitcode("test.bc", NULL);
@@ -55,6 +61,12 @@ int main ()
int (*test5)(int) = vlbdb_specialize(binder);
vlbdb_binder_destroy(binder);
+ void * block = make_adder(33);
+ vlbdb_register_block(unit, block, 0);
+ binder = vlbdb_binder_create_block(unit, block);
+ int (*test6)(int) = vlbdb_specialize(binder);
+ vlbdb_binder_destroy(binder);
+
printf("%p %p -- %i, %i\n", test2, test3, test2(4), test3(5));
return 0;

0 comments on commit 2b3c8ad

Please sign in to comment.