On Sat, Apr 7, 2012 at 20:30, rhasson <[email protected]> wrote: > I'm creating a binding to a C++ library for NLP. You can see the basic of > it here: https://gist.github.com/2331101# > > My problem right now is, in Node when the user instantiates my object with > the "new" command, in C++ land I instantiate my module's object and then > instantiate the Freeling NLP library object so I can call its methods. > I try to save that Freeling object inside my module object so I can use it > later on within other methods such as tokenize (in this example). I use > node::Wrap and node::UnWrap but it seems like either the Freeling object is > wrapped properly, garbage collected or I'm left with a dangling pointer to > nothing. > > As a side note, I had a std::string private member on my object just to > store some text that I receive as one of my arguments to the "new" command. > That was also not saved by the wrap/unwrap methods. I had to make this > variable a v8::Persistent<v8::String> in order for it to be properly > wrapped. > > if I can create the Freeling object and call the tokenize method all in one > place then it works. If I create the Freeling object in my "new" class > method and call the tokenize method in my "tokenize" class method it doesn't > work. My library just hangs. > > I'm running node v.0.7.6 on a Fedora 14 Linux (in a VM on top of Windows) > > Any help would be greatly appreciated.
There's nothing in your gist that springs out as being obviously wrong. I don't have freeling installed so I can't test it but run it in a debugger and put a breakpoint on the destructor, that will tell you if the destructor runs before Tokenize(). -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
