Hi,
I have been using node ffi for various libraries but today I am facing an
unexpected difficulty. Here is a simple C function that takes as parameter
a pointer and allocates memory for that pointer.
int write_headers(char *header)
{
header = calloc(1024, 1);
header[0] = 0x66;
header[1] = 0x4C;
header[2] = 0x61;
header[3] = 0x43;
return 4;
}
In node, I am using the following coffeescript code to call the
write_headers function:
ref = require 'ref'
ffi = require 'ffi'
API = {
'write_headers': ['int', ['pointer']]
}
test = ffi.Library './libtest.so', API
header = ref.NULL_POINTER
res = test.write_headers header.ref()
I tried various options but never succeeded to get the correct value of
header after the call of the write_headers function in order to get the 4
values of the header.
I would appreciate any help on this.
Thank you,GIlles
--
--
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
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].
For more options, visit https://groups.google.com/d/optout.