Using unsigned char buffer with node-ffi
问题 I'm having trouble using a buffer with node-ffi to call the following library function: int ftdi_read_data(struct ftdi_context *ftdi, unsigned char *buf, int size) { ... } http://www.intra2net.com/en/developer/libftdi/documentation/group__libftdi.html#ga72d87e30015c98bd0be22e7c8c873345 Which I have seen used by passing a 'unsigned char buf[size]' to as the buf argument.. So with ffi I try this: ffi = require 'ffi' ref = require 'ref' ftdiContext = ref.types.void ftdiContextPtr = ref.refType