Load multiple libraries
Opened this issue · 5 comments
Trying to load two libraries at once and then use their functions, currently looks pretty simple
private WNScan = koffi.load('hardware-api/omr-scanner/WNScanDll_A6.so');
private WT_IsDevice = this.WNScan.func('WT_IsDevice', 'int', []);
private WT_DeviceOpen = this.WNScan.func('WT_DeviceOpen', 'int', []);
private WT_DeviceClose = this.WNScan.func('WT_DeviceClose', 'int', []);
private WT_ScannerOn = this.WNScan.func('WT_ScannerOn', 'int', []);
private WT_ScannerOff = this.WNScan.func('WT_ScannerOff', 'int', []);
private WT_IsPaper = this.WNScan.func('WT_ScannerOff', 'int', ['int']);
private WT_BarcodeScanSelectBuf = this.WNScan.func('WT_BarcodeScanSelectBuf', 'int', [imgStruct, imgStruct, 'int', 'int']);
private WT_SetLineNumber = this.WNScan.func('WT_SetLineNumber', 'int', ['int']);
private WT_SetPixelDataSize = this.WNScan.func('WT_SetPixelDataSize', 'int', ['int']);
private WT_SetMotorDir = this.WNScan.func('WT_SetMotorDir', 'int', ['int']);
private WOMR = koffi.load('hardware-api/omr-scanner/WOMRDll_A6.so');
private SetConfig = this.WOMR.func('SetConfig', 'int', ['char *']);
private WOMR_CropImage = this.WOMR.func('WOMR_CropImage', 'int', [imgStruct, 'int', imgStruct, imgStruct]);
private ResultImageBuf = this.WOMR.func('ResultImageBuf', 'int', [imgStruct, imgStruct, 'int', 'char *', 'int *', 'int *', 'int *']);
private GetResultData = this.WOMR.func('GetResultData', 'int', ['int', 'char *', 'int *']);
Problem is that after loading the first one lib it fails with second telling that Error: Failed to load shared library: libtiff.so.5: cannot open shared object file: No such file or directory
I believe i'm missing the point how to do that properly but didn't find any alternative. Ty in advance
Ok my bad, it can't load that second lib at all despite the fact it was working with ffi-napi. But still maybe something specified wrongly?
The previous implementation
private WNScan = new Library('hardware-api/omr-scanner/WNScanDll_A6', {
WT_IsDevice: ['int', []],
WT_DeviceOpen: ['int', []],
WT_DeviceClose: ['int', []],
WT_ScannerOn: ['int', []],
WT_ScannerOff: ['int', []],
WT_IsPaper: ['int', [ref.refType('int')]],
WT_BarcodeScanSelectBuf: ['int', [ref.refType(imgStruct), ref.refType(imgStruct), 'int', 'int']],
WT_SetLineNumber: ['int', ['int']],
WT_SetPixelDataSize: ['int', ['int']],
WT_SetMotorDir: ['int', ['int']],
});
private WOMR = new Library('hardware-api/omr-scanner/WOMRDll_A6', {
SetConfig: ['int', [ref.refType('char *')]],
WOMR_CropImage: ['int', [ref.refType(imgStruct), 'int', ref.refType(imgStruct), ref.refType(imgStruct)]],
ResultImageBuf: [
'int',
[
ref.refType(imgStruct),
ref.refType(imgStruct),
'int',
ref.refType('char *'),
ref.refType('int *'),
ref.refType('int *'),
ref.refType('int *'),
],
],
GetResultData: ['int', ['int', ref.refType('char *'), ref.refType('int *')]],
});
also that's not the path/bundles issue since the libraries not in the dist folder and one of them works, really can't get what's wrong with second one
Hi, could you send me the shared libraries? At least WNScanDll_A6, WOMRDll_A6 and the libraries they depend upon?
To niels.martignene@protonmail.com if you can't post it here :)