diff options
Diffstat (limited to 'test/example/c-api-hello-world.c')
-rw-r--r-- | test/example/c-api-hello-world.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/test/example/c-api-hello-world.c b/test/example/c-api-hello-world.c index 066799de6..3b412f67f 100644 --- a/test/example/c-api-hello-world.c +++ b/test/example/c-api-hello-world.c @@ -1,14 +1,16 @@ #include <binaryen-c.h> -// "hello world" type example: create a function that adds two i32s and returns the result +// "hello world" type example: create a function that adds two i32s and returns +// the result 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 params[2] = {BinaryenTypeInt32(), BinaryenTypeInt32()}; + BinaryenFunctionTypeRef iii = + BinaryenAddFunctionType(module, "iii", BinaryenTypeInt32(), params, 2); // Get the 0 and 1 arguments, and add them BinaryenExpressionRef x = BinaryenLocalGet(module, 0, BinaryenTypeInt32()), @@ -17,8 +19,10 @@ int main() { // Create the add function // Note: no additional local variables - // 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); + // 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); // Print it out BinaryenModulePrint(module); @@ -28,4 +32,3 @@ int main() { return 0; } - |