I am creating a linux shared object (.so) from an existing binary tool 
written in C, writing a custom C++ v8 bound native add on which links to 
the shared object.

Everything so far is working swimmingly, node-gyp compiles, links & 
provides the module. The primary functionality is in place and also works 
fine until I attempt to do the following:

>From the existing C functionality compiled as ... 
extern "C" { /* ... */ }

I pass a struct & additional data to another function (also wrapped with 
the extern) which passes that same data to a C++ function (member of a 
class) at which time the call to 
HandleScoope scope;
causes a segfault.


   
#include <node.h>
#include <v8.h>
 
using namespace node;
using namespace v8;
 
/* This function 'ReturnObject' is
 * called from an existing library
 * written in C
*/
extern "C" {
  void ReturnObject() {
    classname cn;
 
    cn.Report();
  }
}
 
void classname::Report() {
  HandleScope scope; // Here is where I am getting segfaults
  classname cn;
 
  Local<Object> obj = Object::New();
  v8::Persistent<v8::Object> pobj(v8::Persistent<v8::Object>::New(obj));
 
  cn.RunCallback(pobj);
} 

My assumption is that when I call HandleScope from the extern wrapped 
function is that the scope is missing. My other assumption is that I cannot 
do this from a child process, which is what I believe the problem is.

Any tips or pointers on how I can accomplish this is appreciated.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/d5f33cec-3162-404c-af97-02a15ff0603b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to