mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-07-30 00:39:16 +02:00
Add architecture detection for loading the correct version of the librdsparser shared library
This commit is contained in:
+14
-3
@@ -4,9 +4,20 @@ const https = require('https');
|
|||||||
const koffi = require('koffi');
|
const koffi = require('koffi');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
const win32 = (os.platform() == "win32");
|
const platform = os.platform();
|
||||||
const unicode_type = (win32 ? 'int16_t' : 'int32_t');
|
const cpuArchitecture = os.arch();
|
||||||
const lib = koffi.load(path.join(__dirname, "librdsparser." + (win32 ? "dll" : "so")));
|
let unicode_type;
|
||||||
|
let shared_Library;
|
||||||
|
|
||||||
|
if (platform === 'win32') {
|
||||||
|
unicode_type = 'int16_t';
|
||||||
|
shared_Library=path.join(__dirname, "libraries", "librdsparser.dll");
|
||||||
|
} else if (platform === 'linux') {
|
||||||
|
unicode_type = 'int32_t';
|
||||||
|
shared_Library=path.join(__dirname, "libraries", "librdsparser_" + cpuArchitecture + ".so");
|
||||||
|
}
|
||||||
|
|
||||||
|
const lib = koffi.load(shared_Library);
|
||||||
const { fetchTx } = require('./tx_search.js');
|
const { fetchTx } = require('./tx_search.js');
|
||||||
|
|
||||||
koffi.proto('void callback_pi(void *rds, void *user_data)');
|
koffi.proto('void callback_pi(void *rds, void *user_data)');
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user