Commit Graph

312 Commits

Author SHA1 Message Date
c0b439e66a feat(runtime-c-api) Rename wasmer_import_trap to wasmer_trap. 2020-01-15 08:37:20 +01:00
176152e7d5 test(runtime-c-api) Remove a hardcoded value. 2020-01-13 07:46:48 +01:00
6e7d5baccc chore(runtime-c-api) Update C/C++ headers. 2020-01-13 07:39:04 +01:00
b494bd860d doc(runtime-c-api) Improve wasmer_import_func_new's documentation. 2020-01-13 07:35:57 +01:00
a506411eb5 doc(runtime-c-api) Improve documentation of wasmer_import_trap. 2020-01-13 07:35:37 +01:00
b45ead289f test(runtime-c-api) Test wasmer_import_trap. 2020-01-13 07:22:03 +01:00
8790f6dbc9 feat(runtime-c-api) Check pointers aren't null in wasmer_import_trap. 2020-01-13 07:20:06 +01:00
4bf3d6dd41 test(runtime-c-api) Test wasmer_import_trap. 2020-01-10 15:14:52 +01:00
684620435f chore(runtime-c-api) Update headers. 2020-01-10 15:14:18 +01:00
35459c2931 feat(runtime-c-api) Implement wasmer_import_trap.
The new `wasmer_import_trap` allows a host function to fail properly
with the Wasmer trapping API.
2020-01-10 15:13:30 +01:00
e913e8928f chore(runtime-c-api) Fix CS. 2020-01-10 15:12:56 +01:00
ec378597f1 chore(runtime-c-api) Update headers. 2020-01-10 14:49:14 +01:00
7b6d8993e1 chore(runtime-c-api) Update C/C++ headers. 2020-01-09 10:17:34 +01:00
67b684ac85 feat(runtime-c-api) Improve DEPRECATED compatibility.
Clang can emulate GNUC or MSVC behaviors. So instead of detecting
whether Clang is used to compile the code, it's better to detect the
targeted features are available.

Code proposed by @nlewycky, thanks!
2020-01-09 10:13:22 +01:00
4f691dde17 chore(runtime-c-api) Update headers. 2020-01-08 15:25:48 +01:00
b31a3dcdec feat(runtime-c-api) Define the DEPRECATED macro.
This PR defines a cross-compiler `DEPRECATED(message)` macro. It must
be used as follows in Rust:

```rust
/// This is a documentation.
/// cbindgen:prefix=DEPRECATED(This is a deprecation message.")
pub extern "C" fn wasmer_foo() -> c_uint {
    42
}
```

It will generate the following C header:

```c
/**
 * This is a documentation.
 */
DEPRECATED("This is a deprecation message.")
unsigned int wasmer_foo();
```

And once this code is used by a C compiler, it will print something
like this (example from Clang):

```
…/test.c:…:…: error: 'wasmer_foo' is deprecated: This is a deprecation message. [-Werror,-Wdeprecated-declarations]
    unsigned int x = wasmer_foo();
                     ^
…/wasmer.h:…:…: note: 'wasmer_foo' has been explicitly marked deprecated here
DEPRECATED("This is a deprecation message.")
^
…/wasmer.h:…:…: note: expanded from macro 'DEPRECATED'
```

This is required for further deprecations.
2020-01-08 15:02:57 +01:00
0274668675 doc(runtime-c-api) Fix a typo. 2020-01-07 14:21:50 +01:00
6a74b7e994 Prepare for 0.12.0 release 2019-12-18 17:24:29 -05:00
6618750ebd Add include guards for WASI APIs in runtime-c-api 2019-12-17 16:25:26 -05:00
bb90cffac9 Address feedback; improve emscripten fn names in C API 2019-12-16 19:43:57 -05:00
a2b47bd591 Update changelog, clean up, fix test 2019-12-16 18:06:37 -05:00
06d4897d11 Merge branch 'master' into feature/emscripten-in-c-api 2019-12-16 13:50:12 -08:00
e86b3941d0 Update Emscripten API layout; expose inner parts to to C API; add test 2019-12-16 15:45:28 -05:00
f1c95a81ab Add foundational emscripten functions and types to C API 2019-12-13 14:02:48 -08:00
39f5a79254 Test the capi with multiple backends 2019-12-12 16:38:58 -08:00
4ef799f23d feat(runtime-c-api) Support WasiVersion::Latest. 2019-12-04 15:34:56 +01:00
4fc6adf9c2 chore(runtime-c-api) Remove a useless format!. 2019-12-04 15:28:38 +01:00
345511a4f9 fix(runtime-c-api) Fix From<c_uchar> for Version.
0 matches to `Unknown`, 1 matches to `Snapshot0` and 2 matches to
`Snapshot1`.
2019-12-04 15:28:37 +01:00
90f3c894c1 doc(runtime-c-api) Improve documentation of wasmer_wasi_generate_import_object_for_version. 2019-12-04 15:28:37 +01:00
0c5021484f fix(runtime-c-api) Use get_wasi_version in non-strict mode. 2019-12-04 15:28:37 +01:00
4fe8286b81 feat(runtime-c-api) Avoid undefined behavior with user-given version.
When the version has type `Version`, we expect the user to give a
valid `Version` variant. Since the `Version` is basically a `uint8_t`,
the user is able to pass everything she wants, which can create an
undefined behavior on the Rust side.

To avoid such situation, the version has now type `c_uchar` (`unsigned
char` or `uint8_t` on C side —on most platforms). Then the `From`
trait is implemented on `Version`. In case the value is unbound,
`Version::Unknown` is returned.
2019-12-04 15:28:37 +01:00
912713f88f test(runtime-c-api) Test the new WASI version API.
This patch updates `test-wasi-import-object` to test the new
`wasmer_wasi_get_version` &
`wasmer_wasi_generate_import_object_for_version` functions, and the
new `Version` type.
2019-12-04 15:28:37 +01:00
0391ade76f chore(git) Ignore the object file test-import-object. 2019-12-04 15:28:37 +01:00
7fb934f5d0 chore(runtime-c-api) Fix CS in CMakeLists.txt. 2019-12-04 15:28:37 +01:00
e2c353b926 chore(runtime-c-api) Update C/C++ headers. 2019-12-04 15:28:37 +01:00
ca4a1b41a6 feat(runtime-c-api) Ability to generate ImportObject for a specific WASI version.
This patch introduces 2 new functions:

* `wasmer_wasi_generate_import_object_for_version` and
* `wasmer_wasi_get_version`.

It mimics the current API provided by `wasmer_wasi`, nothing fancy
here. It's just a regular port to C/C++.

Because `wasmer_wasi::get_wasi_version` returns an option, and in
order to simplify the C/C++ API, `wasmer_wasi_get_version` can return
`Version::Unknown` in case of an error. It's up to the user to check
the version is valid (i.e. not unknown).
2019-12-04 15:28:37 +01:00
fdc3d5107a doc(runtime-c-api) Suggest to test in release mode. 2019-12-04 15:28:37 +01:00
bb1e7a8d78 Prepare for 0.11.0 release 2019-11-22 11:18:06 -08:00
fc733647ec Add info in c api readme in the testing section 2019-11-20 16:38:44 -08:00
4a84441ab0 Run WASI C API tests based on feature; prevent cmake caching 2019-11-20 15:41:33 -08:00
9468e229f4 chore(runtime-c-api) Update header files. 2019-11-20 13:30:02 +01:00
dfe7c0d764 fix(runtime-c-api) Add support for GNUC when defining ARCH_X86_64.
`ARCH_X86_64` is correctly defined for GCC or clang, but gnuc was
missing. This patch fixes that.
2019-11-20 13:27:18 +01:00
cebcb4c927 Prepare for 0.10.2 release 2019-11-15 14:55:53 -08:00
074a8f9747 Merge branch 'fix-runtime-c-api-header-preprocessor-clang' of github.com:Hywan/wasmer into fix-runtime-c-api-header-preprocessor-clang 2019-11-14 14:46:09 +01:00
c43a7c78d0 Merge branch 'master' into fix-runtime-c-api-header-preprocessor-clang 2019-11-14 14:45:27 +01:00
987b0765c0 chore(runtime-c-api) Update header files. 2019-11-14 14:37:55 +01:00
42b02bee71 fix(runtime-c-api) Write macros at column 0. 2019-11-14 14:37:06 +01:00
9127eaf825 Add categories and keywords to Cargo.tomls 2019-11-13 15:46:09 -08:00
be9d7f2e6e chore(runtime-c-api) Update header files. 2019-11-13 15:29:33 +01:00
b081d17ab0 feat(runtime-c-api) Add support for clang in WASMER_H_MACROS. 2019-11-13 15:28:57 +01:00