Acceptable actions to take inside a C++ addon's initialization function?
25 views
Skip to first unread message
Ryan Cole
unread,
Nov 10, 2012, 7:25:34 PM11/10/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to nod...@googlegroups.com
I'm getting a seg fault core dump in a simple module. I can eliminate the seg fault if I comment out a ThrowException call in the initialization function.
Things makes me wonder, what are the acceptable actions to take inside of this initialize function? Is this seg fault occurring because I'm throwing an exception while loading the module? Obviously I need to figure out why the function call on line 27 is failing, so that I can avoid that error condition all together. How should I handle initialization failures, though?
Thanks,
Ryan
Nathan Rajlich
unread,
Nov 10, 2012, 7:35:26 PM11/10/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to nod...@googlegroups.com
Generally you just set functions and other properties on the provided
"target" object (which end up being the native module's exports).
Throwing from within an the initialization function, it'd say, is
undefined behavior.
However, it may be possible to catch those errors and act
appropriately, but I haven't checked that code yet to verify.