Embind and private destructors

121 views
Skip to first unread message

Joshua Litt

unread,
Apr 8, 2014, 9:38:13 PM4/8/14
to emscripte...@googlegroups.com
I am trying to build a library with embind, and I have found the docs and test file quite helpful.

However, I have run into an issue.  One of the classes I need to provide an interface for has a private destructor.  I can probably just wrap the class, but that will be quite time consuming.  Is there anyway to tell embind not to call the classes destructor?  Right now I get compiler errors.

Any help would be appreciated.

Chad Austin

unread,
Apr 10, 2014, 5:53:19 PM4/10/14
to emscripte...@googlegroups.com
Hi Joshua,

If you expose a class without a destructor, how can that instance get deallocated?

If embind is storing bookkeeping data for each C++ object exposed to JavaScript, how would embind know to clean that up?

Can you explain your use case in some more detail?

Thanks!
Chad



--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Chad Austin
Technical Director, IMVU

Joshua Litt

unread,
Apr 10, 2014, 6:59:48 PM4/10/14
to emscripte...@googlegroups.com
Chad,

I actually worked around this by using a C interface.

My use case was to return a pointer managed by the C++ layer to JS.  This pointer is later used to query data and such, but the class itself is cleaned up under its own terms.  The class is deallocated by a friend class.

Thanks for the response!


--
You received this message because you are subscribed to a topic in the Google Groups "emscripten-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/emscripten-discuss/F1U123cLVMg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to emscripten-disc...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages