aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--system/include/emscripten/bind.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/system/include/emscripten/bind.h b/system/include/emscripten/bind.h
index cb8f396d..ffbf9401 100644
--- a/system/include/emscripten/bind.h
+++ b/system/include/emscripten/bind.h
@@ -806,6 +806,13 @@ namespace emscripten {
typedef InterfaceType interface;
+ template<class ConcreteWrapperType>
+ static std::shared_ptr<InterfaceType> cloneToSharedPtr(InterfaceType& i) {
+ ConcreteWrapperType* cw = new ConcreteWrapperType(&i);
+ InterfaceType* ip = dynamic_cast<InterfaceType*>(cw);
+ return std::shared_ptr<InterfaceType>(ip);
+ }
+
void initialize(internal::EM_VAL handle) {
if (jsobj) {
internal::_embind_fatal_error(