Nathan, 

I started using node-ffi which works great.  I need to create some structs 
so I'm using ref-struct.  Now some of my structs have pointers to 
themselves like this:

typedef struct pst_block_recorder {
    struct pst_block_recorder  *next;
    int64_t                     offset;
    size_t                      size;
    int                         readcount;
} pst_block_recorder;

I tried to recreate this with ref-struct like this:
var pst_block_recorder = Struct ({
    //struct pst_block_recorder  *next;
    'next': ref.refType(pst_block_recorder),
    //int64_t                     offset;
    'offset': 'int64',
    //size_t                      size;
    'size': 'size_t',
    //int                         readcount;
    'readcount': 'int'
});

But I get the following error:
assert.js:102
  throw new assert.AssertionError({
        ^
AssertionError: could not determine a proper "type" from: undefined
    at Object.coerceType (/home/roy/node_modules/ref/lib/ref.js:389:3)
    at Object.refType (/home/roy/node_modules/ref/lib/ref.js:304:23)


I also tried making those struct fields "pointer" types but the C library 
doesn't seem to populate them correctly.

Any thoughts?

Thanks,
Roy

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
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 post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to