Let's say in C++ i have a function with the following signature:
A<B> getTemplatedClassInstance();
where A & B are some classes. I am then trying to generate WebIDl bindings for use in an emscripten build to use the C++ code from Javascript. I have a working bindings file with various other classes, enums, etc that can be bound and accessed from JS, but I'm at a loss for how to represent templated types (class A, in the above example). I have tried various combinations of WebIDL binding declarations like:
interface A {};
interface A<> {};
interface A<B> {};
interface C {
A<B> getTemplatedClassInstance();
};
interface C {
A getTemplatedClassInstance();
};
But any use of angle brackets '<>' generates a syntax error from the webidl_binder.py script (included with the emscripten sdk) used to build it, and if I leave the declaration and uses of A as untemplated, the bindings file builds, but the final emscripten compilation (emcc ...) of the bindings with the C++ library fails in the bindings cpp file with:
error: use of class template requires template arguments
which makes sense. Oddly the WebIDL documentation doesn't mention template types at all. I scoured the web and found a single reference to binding specific template instantiations with "Embind", but nothing regarding WebIDL.