Need help with wasmception?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

yurydelendik
127 Stars 25 Forks 53 Commits 3 Opened issues

Description

Minimal C/C++ language toolset for building wasm files

Services available

!
?

Need anything else?

Contributors list

# 4,948
JavaScr...
React
Firefox
flowtyp...
42 commits
# 208,193
React
TypeScr...
React N...
i18next
1 commit
# 158,519
TypeScr...
HTML
slack
Heroku
1 commit
# 12,046
Ruby
nginx
multith...
rack
1 commit
# 19,753
Objecti...
Swift
cocoapo...
pintere...
1 commit

NOTE: this project is archived in favor of WASI SDK.

wasmception

Minimal toolset for building wasm files

Export functions

Use linker's

--export
parameter to specify exports (with clang use
-Wl,--export
, e.g.
-Wl,--export=foo,--export=bar
). The use of
__attribute__ ((visibility ("default")))
is no longer preferable way to make methods visible --
--export-dynamic
needs to be added.

Compile C file

$(WASMCEPTION)/dist/bin/clang --sysroot=$(WASMCEPTION)/sysroot/ hi.c -o hi.wasm -nostartfiles -Wl,--no-entry,--export=foo

Compile C++ file

$(WASMCEPTION)/dist/bin/clang++ --sysroot=$(WASMCEPTION)/sysroot/ hi.cpp -o hi.wasm -nostartfiles -Wl,--no-entry,--export=bar -fno-exceptions

Required
main
and
_start
functions

The

-nostartfiles
will not require you to define the
main
function, but will be looking for the
_start
function: use
-Wl,--no-entry
clang (linker) option to avoid specified entry point. As alternative, you can add
void _start() {}
(or
extern "C" void _start() { }
in C++) to make linker happy due to
-nostartfiles
.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.