Could anyone help me to solve a problem with nodejs and C library (call to 
some dll methods)?


My dll have these methods:

void Open(char *Path);int Execute(TINData *InData,TOUData *OutData);void 
Close(void);

with these data structures:

typedef struct {
      char Value[8+1];
      char Type [1+1];
      int Id;
      unsigned char Parity;} TINData
typedef struct {
      char Cash[8+1];
      char Telephone[11+1];
      char CallType[3+1];
      char CallResult[2+1];
      char Description[24+1];} TOUTData

My nodejs code:

var ffi = require('ffi');var ref = require('ref');var StructType = 
require('ref-struct');


var TINData = StructType({
      'Value': 'string',
      'Type': 'string',
      'Id': 'int',
      'Parity': 'string'});
var TOUTData = StructType({
      'Cash': 'string',
      'Telephone': 'string',
      'CallType': 'string',
      'CallResult': 'string',
      'Description': 'string'});



var mylibrary = ffi.Library('OurLib.dll', {
      'Open' : ['void', ['string']],
      'Execute' : ['void', [TINData, TOUTData]],
      'Close' : ['void', ['void']]});

myLibrary.Open('myConnection');
var myTINData = new TINData();           
myTINData.Value = '00000010';
myTINData.Type = '1';
myTINData.Id = 123;
myTINData.Parity = '0';

-- 
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/830423ff-1bc1-4f36-b482-8981a38f5f05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to