Ok, stuck again.  Got everything working with the integer and pointer thing
from all the help before (thanks!) but now I'm stuck in another place.  The
source files I have are .C files with .H headers.  I can compile them using
node-gyp with no issues and apparently bind them to my .CC file with no
issue.

When I try and actually USE them though I get back an error saying
undefined symbol: <somevalue> where <somevalue> is always _Z11<methodName>v
the _Z11 and v never changes.  The <methodName> part is always the name of
the method from the .C file.

I'm guessing this is something really simple, but I don't know enough about
C/CC/whatever to know where I'm screwing up.

Here is a simple example, while this isn't the real code it blows up just
like the real code :)

/* lib.c */
#include lib.h
int test_linked(void){
  return 1;
}

/* lib.h */
#ifndef _LIB_
#define _LIB_
int rest_linked(void);
#endif

/*lib.cc*/
#include <node.h>
#include <v8.h>

#include "lib.h"

using namespace v8;

Handle<Value> Test(const Arguments& args){
  HandleScope scope;
  return scope.Close(Number::New(test_linked()));
}

void init(Handle<Object> exports) {
  exports->Set(String::NewSymbol("test"),
      FunctionTemplate::New(Test)->GetFunction());
}

NODE_MODULE(lib, init)

/* binding.gyp */

{
  "targets": [
    {
      "target_name": "lib",
      "sources": [
        "src/lib.c",
        "src/lib.cc"
      ]
    }
  ]
}

Building with node-gyp rebuild results in all proper .O files put where you
would expect (build/Release/obj.target/lib/src) and the .NODE file going
where it should (build/Release)

Then using:
var lib = require('./build/Release/lib');
lib.test();

Fails with:
node: symbol lookup error: /home/.../build/Release/lib.node: undefined
symbol: _Z11test_linkedv


I know this is something I'd doing wrong, but not sure what.  I'm guessing
there is some reference to the .O files missing or they are where they
shouldn't be so when the .NODE file loads it can't find the .O files and
thus can't link the methods.

As always, any help greatly appreciated.

 - Jeremy

-- 
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/CAAhs7EgWnAMob7jn-HpUWS1gjQyTKCKjVHC2utFmjnsc8gF8sA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to