Comments (5)
Are you trying to avoid just calling register_vector
for each bound type or avoid register_vector
and a class_
binding for each type?
If you're fine with still doing the class bindings, you can create a template wrapper around class_
or a macro that registers the class and vector at the same time.
from emscripten.
I already have all of the class bindings. How would I
create a template wrapper around class_ or a macro that registers the class and vector at the same time.
?
from emscripten.
Something like:
using namespace emscripten;
struct Foo {};
template<typename T>
class_<T> class_and_vector(const char* name) {
std::string vectorName(name);
vectorName.append("Vector");
register_vector<T>(vectorName.c_str());
return class_<T>(name);
}
EMSCRIPTEN_BINDINGS(xxx) {
class_and_vector<Foo>("Foo")
.constructor<>();
}
from emscripten.
So on the js side, I'd have Module.Foo
and Module.FooVector
?
from emscripten.
I believe I didn't have a great understanding of emscripten::val
and am fine with having function args in cpp that I then interrogate for myArray["length"]
and access like myArray[i].as<MyBoundClass>();
I appreciate your help in any case!
from emscripten.
Related Issues (20)
- embind d.ts defintion for std::string
- Any example to compile a project via emscripten and use it in wasmtime? HOT 10
- In `-sMODULARIZE` mode the `moduleArg` should not be modified in place
- Bind error of getting a pointer property in class
- Make mimalloc headers accessible HOT 2
- lto2.test_embind_i64_val is failing
- evaluation of std::sin in C++ is slower than in JS directly HOT 3
- [CXX1429] error when building with cmake using HOT 1
- Bug: when compiling executable, emcc "forgets" provided needed library HOT 8
- [WASMFS] FileSystemHandle.move causes OPFS to fail in Chrome HOT 1
- NODEFS not compatible with Deno when used through Pyodide HOT 4
- Unification for async APIs for the header file emscripten.h
- Unification for async APIs for the header file HTML5.h
- Unification for async APIs for the header file proxying.h
- Unification for async APIs for the header file Val.h
- Unification for async APIs for the header file Fetch.h
- Unification for async APIs for the header file webaudio.h
- 256-bit AVX intrinsics support HOT 1
- 'emcc' is not recognized as an internal or external command, operable program or batch file. HOT 2
- Multiple main function definitions can cause runtime error in chrome and crash renderer process in electron HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emscripten.