Pergunta

I am writing a node.js native bindings project and I am having some trouble debugging.

First, can anyone explain why the New function is being called in the require? The js code being called is var Can = require('bindings')('CANInterface'); but results in an immediate exit with no errors. It shouldn't need to call New of the function yet, correct? Second, why is my code crashing on the following line of the New function?

cout << "Debug: Creating new CNI" << endl;

if (args.Length() != 1){ <<<< Crashes here <<<<
    cout << "Error: Invalid arguments length" << endl;
    return ThrowException(String::New("Expected one argument!"));
}

My output only prints

Debug: Creating new CNI

and then immediately crashes with no errors or output.

Full code is available here.

Foi útil?

Solução

Following the advice of some of my comments and moving just about everything around to more closely match the demo here, I have finally solved my issue and have a working implementation. Thank you to those in the questions that helped.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top