Skip to content

Instantly share code, notes, and snippets.

@carlopi
Created September 13, 2021 08:35
Show Gist options
  • Save carlopi/6b38fe1f2347a8cd712a9e9ff83c47ad to your computer and use it in GitHub Desktop.
Save carlopi/6b38fe1f2347a8cd712a9e9ff83c47ad to your computer and use it in GitHub Desktop.
Wrapping Cheerp ES6 modules
[[cheerp::jsexport]]int add(int a, int b)
{
return a+b;
}
all:
/opt/cheerp/bin/clang++ add.cpp -cheerp-make-module=es6 -o add.js -O3
import {add} from "./wrap_add.js"
console.log(add(23, 19));
import instantiate from './add.js'
var module = await instantiate();
var add = module.add;
export {add};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment