glose
glose

Reputation: 517

Node.js extension for .net

Attempting to use node-sharp - https://github.com/anodejs/node-sharp to load some existing .net assemblies I have. Have not been able to get it to work so far - only seem to get a "The specified procedure could not be found".

So I attempted to start with a simpler example and followed this guide - http://coderesearchlabs.com/articles/BNWCA.pdf. Same result.

I'm running in Windows 64 with 32 bit version of Node.js installed version 0.8.16.

Error stack trace -

> require("./Sharp").hello
Error: The specified procedure could not be found.
C:\Program Files (x86)\nodejs\Sharp.node
    at Object.Module._extensions..node (module.js:485:11)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at repl:1:2
    at REPLServer.self.eval (repl.js:109:21)
    at Interface.<anonymous> (repl.js:248:12)
    at Interface.EventEmitter.emit (events.js:96:17)
    at Interface._onLine (readline.js:200:10)
> console.log('Version: ' + process.version);
Version: v0.8.16
undefined
>

Source is

#pragma comment(lib, "node")

#include <node.h>
#include <v8.h>

using namespace node;
using namespace v8;

extern "C" void NODE_EXTERN init (Handle<Object> target)

{

HandleScope scope;

target->Set(String::New("hello"), String::New("world"));

}

NODE_MODULE(test, init)

Upvotes: 0

Views: 543

Answers (1)

Jonathan Lonowski
Jonathan Lonowski

Reputation: 123423

Make sure the module name matches what was passed to NODE_MODULE:

NODE_MODULE(test, init)  // => `test.node`
NODE_MODULE(Sharp, init) // => `Sharp.node`

Also, as that guide appears to be for Node 0.6.x with 0.8.0 released after it, you may find the Addons and node-gyp documentation useful for Node 0.8 development.

Upvotes: 1

Related Questions