Skip to content

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

Notifications You must be signed in to change notification settings

gwsystems/wasmception

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wasmception

Minimal toolset for building wasm files

Export functions

Use __attribute__ ((visibility ("default"))) to make methods visible

Compile C file

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

Compile C++ file

$(WASMCEPTION)/dist/bin/clang++ --target=wasm32-unknown-unknown-wasm --sysroot=$(WASMCEPTION)/sysroot/ hi.cpp -o hi.wasm -nostartfiles -Wl,--no-entry

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.

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Makefile 59.3%
  • CMake 13.1%
  • JavaScript 12.0%
  • HTML 10.1%
  • C 5.5%