Add embind example to Bazel docs (#910)
* Add embind example to Bazel docs * address feedback
This commit is contained in:
16
bazel/test_external/hello-embind.cc
Normal file
16
bazel/test_external/hello-embind.cc
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <emscripten/bind.h>
|
||||
|
||||
using namespace emscripten;
|
||||
|
||||
class HelloClass {
|
||||
public:
|
||||
static std::string SayHello(const std::string &name) {
|
||||
return "Yo! " + name;
|
||||
};
|
||||
};
|
||||
|
||||
EMSCRIPTEN_BINDINGS(Hello) {
|
||||
emscripten::class_<HelloClass>("HelloClass")
|
||||
.constructor<>()
|
||||
.class_function("SayHello", &HelloClass::SayHello);
|
||||
}
|
||||
Reference in New Issue
Block a user