Enable register native with iwasm (#1120)
Enable register native with iwasm application, add sample and update document.
This commit is contained in:
29
samples/native-lib/wasm-app/main.c
Normal file
29
samples/native-lib/wasm-app/main.c
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
test_add(int x, int y);
|
||||
|
||||
int
|
||||
test_sqrt(int x, int y);
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int x = 10, y = 20, res;
|
||||
|
||||
printf("Hello World!\n");
|
||||
|
||||
res = test_add(x, y);
|
||||
printf("%d + %d = %d\n", x, y, res);
|
||||
|
||||
res = test_sqrt(x, y);
|
||||
printf("sqrt(%d, %d) = %d\n", x, y, res);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user