I'm making a nodejs app that have to pull data from a NI USB 6210. National Instruments, gives away a bunch of examples that use their (pure) C libs, since, I'm on nodejs, I thought I could "easily" recycle them into a node module using node-gyp, but I discovered that node modules are more likely to be written in C++, rather than plain C (as described in the reference), so I was wondering about other possible solutions. Aside from that the whole library thing is also based on a bunch of frameworks ( on OSX )
/Library/Frameworks/nidaqmxbase.framework
/Library/Frameworks/nidaqmxbaselv.framework
/Library/Frameworks/lib67xx.framework
/Library/Frameworks/libDIO96.framework
/Library/Frameworks/libESeries.framework
/Library/Frameworks/libmiteDma.framework
/Library/Frameworks/libMSeries.framework
/Library/Frameworks/libSSeries.framework
/Library/Frameworks/libUSB-92xx.framework
so my second question is how does the frameworks interact with nodejs? I've a little bit of confusion about this.
UPDATE
Thanks to @mscdex I've built my first node module that should just wrap the frameworks and make'em available on the node side. This is what I've done so far:
binding.gyp
{
"targets": [
{
"target_name": "addon",
"sources": [
],
"include_dirs": [
"./includes/NIDAQmxBase.h"
],
"conditions": [
[
"OS=='mac'",
{
"defines": [
"__MACOSX_CORE__"
],
"architecture": "i386",
"link_settings": {
"libraries": [
"-framework",
"nidaqmxbase",
"-framework",
"nidaqmxbaselv"
]
}
}
]
]
}
]
}
with this I've run the configure and the build commands
to be noticed that I'm using nw-gyp that is a hack of the node-gyp, because I need to build a module for node-webkit, but it's just like node-gyp with a few improvements.
This operation produced a file called addon.node (weighted 8kb)
After that I've tried to run a simple js test file
var ni = require('./libs/addon');
console.log(ni);
as I ran this it produced
Error: Symbol addon_module not found.
at Module.load (module.js:352:32)
at Function.Module._load (module.js:308:12)
at Module.require (module.js:360:17)
at require (module.js:376:17)
at window.require (eval at undefined, <anonymous>:1:112)
at eval (file:///Users/myUser/MyPath/MyNodeWebkitProject/public/js/ni-daqmx.js:1:10)
and that is where I'm stuck.