Hi nathan I'm sorry,I forgot to paste this code:

var TINData = new StructType();
TPOSData.defineProperty('Value', new fixedString(8+1));
TPOSData.defineProperty('Type', new fixedString(1+1));
TPOSData.defineProperty('Id', 'int');
TPOSData.defineProperty('Id', 'string');
var TOUTData = new StructType();
TOUTData.defineProperty('Telephone', new fixedString(11+1));
TOUTData.defineProperty('CallType', new fixedString(3+1));
TOUTData.defineProperty('CallResult', new fixedString(2+1));
TOUTData.defineProperty('Description', new fixedString(24+1));

I am getting a reference to the myTOUTData to inspect the values, to see if 
they are correctly in their positions ,so I am able to parse the result.

I am developing using eclipse with node plugin , and I have usually this 
error  "Malloced operator new Allocation failed - process out of memory"
thank you for your help
Leo


Il giorno martedì 29 settembre 2015 05:42:04 UTC+2, Nathan Rajlich ha 
scritto:
>
> You don't seem to actually be *using* `fixedString` anywhere. Sorry, I 
> should have explained better. Rather than specifying "string" as the type 
> inside the struct types, you need to create instances of the FixedType, and 
> specify the amount of bytes that should be allocated for that field.
>
> So `char Value[8+1]` should become `'Value': FixedString(8+1)`.
>
> Also I'm not sure why you're getting a reference to the `myTOUTData` 
> instance on the last line, but I would suspect you would simply inspect the 
> values in the struct at that point to see what the Execute() function put 
> in that space.
>
> Hope that helps!
>
> On Mon, Sep 28, 2015 at 2:18 AM, Leopoldo Belmonte <[email protected] 
> <javascript:>> wrote:
>
> Hi Nathan, thank you for your answer!!!
>
> I have modified my code:
>
> var ffi = require('ffi');var ref = require('ref');var StructType = 
> require('ref-struct');
>
> var fixedString = require('ref-fixed-string');
>
>
> var TINData = new StructType({
>       'Value': 'string',
>       'Type': 'string',
>       'Id': 'int',
>       'Parity': 'string'});
>
>
> var TINDataPtr = ref.refType(TINData);
> var TOUTData = new StructType({
>       'Cash': 'string',
>       'Telephone': 'string',
>       'CallType': 'string',
>       'CallResult': 'string',
>       'Description': 'string'});
>
> var TOUTDataPtr = ref.refType(TOUTData);
>
> var mylibrary = ffi.Library('OurLib.dll', { 'Open' : ['void', ['string']], 
> 'Execute' : ['void', [TINDataPtr, TOUTDataPtr ]],
> 'Close' : ['void', ['void']] }); myLibrary.Open
>
> ...

-- 
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/46bd1db4-a952-4fe8-8726-730f762b84d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to