You've already forked fm-dx-webserver
mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-02-26 22:13:53 +01:00
Merge pull request #27 from bkram/Bkram/shared-library-detection
Add architecture detection for loading the correct version of the librdsparser shared library
This commit is contained in:
@@ -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)');
|
||||||
|
|||||||
BIN
libraries/librdsparser_arm.so
Normal file
BIN
libraries/librdsparser_arm.so
Normal file
Binary file not shown.
BIN
libraries/librdsparser_arm64.so
Normal file
BIN
libraries/librdsparser_arm64.so
Normal file
Binary file not shown.
Reference in New Issue
Block a user