I'm looking for help with building an addon for Node.js on AIX.

I'm working on an AIX 7.1 powerpc box, with Node.js 0.11.13 for powerpc 
from andrewlow/node on GitHub. 
Make is GNU Make v 3.81; gcc is v4.8.2.

I don't have root access on the system, so I have installed Node to a 
folder in my homespace.

At the moment, I have a very simple "Hello, World" addon that I'm trying to 
use on AIX. The same cpp file has been added to a Visual Studio (2010) 
project on Windows 7, which has built successfully and can be required in 
Node.

I am able to build the addon using node-gyp on AIX; I copy the resulting 
.node file to the same folder as my node executable; when I try to require 
the add on, it fails with: 

"Error: Module did not self-register.
    at Error (native)
    at Module.load (module.js:349:32)
    at Function.Module._load (module.js:305:12)
    at Module.require (module.js:357:17)
    at require (module.js:373:17)
    at repl:1:9
    at REPLServer.defaultEval (repl.js:130:27)
    at bound (domain.js:257:14)
    at REPLServer.runBound [as eval] (domain.js:270:12)
    at REPLServer.<anonymous> (repl.js:277:12)"

The addon is defined in a single file:

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

using namespace node;
using namespace v8;

class HelloWorld : public ObjectWrap
{
public:
    static Persistent<Function> constructor;

    static void init(Handle<Object> exports)
    {
        Isolate* isolate = Isolate::GetCurrent();
        Local<FunctionTemplate> tpl = FunctionTemplate::New(isolate, New);
        tpl->SetClassName(String::NewFromUtf8(isolate, "HelloWorld"));
        tpl->InstanceTemplate()->SetInternalFieldCount(1);

        NODE_SET_PROTOTYPE_METHOD(tpl, "hello", Method);

        constructor.Reset(isolate, tpl->GetFunction());
        exports->Set(String::NewFromUtf8(isolate, "HelloWorld"), 
tpl->GetFunction());
    }

    static void Method(const FunctionCallbackInfo<Value>& args)
    {
        Isolate* isolate = Isolate::GetCurrent();
        HandleScope scope(isolate);
        args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world"));
    }

    static void New(const FunctionCallbackInfo<Value>& args)
    {
        Isolate* isolate = Isolate::GetCurrent();
        HandleScope scope(isolate);
        HelloWorld* hw = new HelloWorld();
        hw->Wrap(args.This());
        args.GetReturnValue().Set(args.This());
    }
};

Persistent<Function> HelloWorld::constructor;

extern "C" {
    static void init(Handle<Object> target)
    {
       HelloWorld::init(target);
    }

    NODE_MODULE(hello, init);
}

I would be very grateful for any guidance on this.

-- 
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/d09cb46e-8bfc-49a7-bc2f-b69233e2fbe4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to