I am trying to write a C++ module for Node Js for a USB device. It is an accesio USB-IIRO-16 I/O board (accesio.com/MANUALS/USB-IIRO-16.PDF). I have the linux drivers installed along with libusb on Ubuntu 12.04 LTS. I have the sample apps (written in C++) running fine with the I/O board and am able to communicate with it just fine in C++. I'm new to writing nodejs modules, and haven't written C++ since college either. I have the module compiling fine as well. I am using the USBDeviceManager class provided by accesio which they use in their sample app.
I used this as a base for the module: https://github.com/kkaefer/node-cpp-modules/tree/master/06_objects
I replaced the hpp file with the USBDeviceManager provided by accesio that is used in the sample app, and added ObjectWrap
class USBDeviceManager : public node::ObjectWrap {...}
The rest is the same as the USBDeviceManager along with the example module code. Everything compiles fine, however, when I run the node run.js I receive:
module.js:485
process.dlopen(filename, module.exports);
^
Error: /home/parallels/Documents/node-accesio/build/Release/accesio.node: undefined symbol: _ZTVN6AIOUSB16USBDeviceManagerE
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 Object.<anonymous> (/home/parallels/Documents/node-accesio/run.js:1:77)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
I've tried a lot of moving code around and some online documentation but can not figure out what to do at this point. The cpp and js files are still the same as the example module app right now (https://github.com/kkaefer/node-cpp-modules/tree/master/06_objects). the only thing that's different is adding the USBDeviceManager to the hpp file and the AIOUSB namespace.
Basically what I want to do, is to be able to read/write to the I/O board similar to the sample application found here: http://accesio.com/files/packages/AIOUSB-Latest.tar.gz