我有一个 DLL,声明如下:
READIDCARD_API typedef void(*PIDDataCB)(char * pData);
READIDCARD_API int initReadIdcard(PIDDataCB func);
DLL下载:<a href="https://drive.google.com/file/d/13JinraIr3N_6V_VrIfgHyB4_jW2V1s0f/view?usp=sharing" rel="nofollow noreferrer">32位dll文件(谷歌驱动下载)
dll文件运行良好,使用QT加载并转换数据时使用local8bit
我使用 node.js 和 node-ffi 来加载它
const ffi = require('ffi');
const ref = require("ref");
let ReadIdcard = ffi.Library('./ReadIdcard.dll', {
'initReadIdcard': ['int', ['pointer']]
});
let callback = ffi.Callback('void', ['string'],
function(data) {
console.log("data: ", data);
});
console.log("registering the callback");
let z = ReadIdcard.initReadIdcard(callback);
console.log('done');
// Make an extra reference to the callback pointer to avoid GC
process.on('exit', function() {
callback
});
我的环境:Windows7 64bit / Node.js 32bit
运行代码,“sorry”字符串前的������˼��������是中文
我该怎么办,或者将其转换为显示正确,谢谢。