I'm trying to use libvoikko using ffi, ref and ref array modules. But I can't seem to access return value from the library, unless I'm doing something that really shouldn't affect anyhing.
var ffi = require('ffi');
var ref = require('ref');
var ArrayType = require('ref-array');
var StringArray = ArrayType('string');
var PointerArray = ArrayType('pointer');
var voikko = ffi.Library('libvoikko.so', {
'voikkoInit': ['pointer', ['pointer', 'string', 'string']],
'voikkoAnalyzeWordCstr': ['pointer', ['pointer', 'string']]
});
var outError = ref.alloc('string');
var handle = voikko.voikkoInit(outError, 'fi_FI', null);
var rtn = PointerArray.untilZeros(voikko.voikkoAnalyzeWordCstr(handle, 'kissa'));
//undefined
console.log(rtn[0]);
StringArray.untilZeros(new Buffer(1));
//<SlowBuffer>
console.log(rtn[0]);
I'm trying to use libvoikko using ffi, ref and ref array modules. But I can't seem to access return value from the library, unless I'm doing something that really shouldn't affect anyhing.