diff options
Diffstat (limited to 'test/example/c-api-hello-world.c')
-rw-r--r-- | test/example/c-api-hello-world.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/test/example/c-api-hello-world.c b/test/example/c-api-hello-world.c index 3b412f67f..550176dc6 100644 --- a/test/example/c-api-hello-world.c +++ b/test/example/c-api-hello-world.c @@ -1,4 +1,3 @@ - #include <binaryen-c.h> // "hello world" type example: create a function that adds two i32s and returns @@ -8,9 +7,9 @@ int main() { BinaryenModuleRef module = BinaryenModuleCreate(); // Create a function type for i32 (i32, i32) - BinaryenType params[2] = {BinaryenTypeInt32(), BinaryenTypeInt32()}; - BinaryenFunctionTypeRef iii = - BinaryenAddFunctionType(module, "iii", BinaryenTypeInt32(), params, 2); + BinaryenType ii[2] = {BinaryenTypeInt32(), BinaryenTypeInt32()}; + BinaryenType params = BinaryenTypeCreate(ii, 2); + BinaryenType results = BinaryenTypeInt32(); // Get the 0 and 1 arguments, and add them BinaryenExpressionRef x = BinaryenLocalGet(module, 0, BinaryenTypeInt32()), @@ -22,7 +21,7 @@ int main() { // Note: no basic blocks here, we are an AST. The function body is just an // expression node. BinaryenFunctionRef adder = - BinaryenAddFunction(module, "adder", iii, NULL, 0, add); + BinaryenAddFunction(module, "adder", params, results, NULL, 0, add); // Print it out BinaryenModulePrint(module); |