1
0
mirror of https://github.com/KubaPro010/fm-dx-webserver.git synced 2026-02-26 14:11:59 +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:
Marek Farkaš
2024-02-14 12:51:14 +01:00
committed by GitHub
5 changed files with 14 additions and 3 deletions

View File

@@ -4,9 +4,20 @@ const https = require('https');
const koffi = require('koffi');
const path = require('path');
const os = require('os');
const win32 = (os.platform() == "win32");
const unicode_type = (win32 ? 'int16_t' : 'int32_t');
const lib = koffi.load(path.join(__dirname, "librdsparser." + (win32 ? "dll" : "so")));
const platform = os.platform();
const cpuArchitecture = os.arch();
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');
koffi.proto('void callback_pi(void *rds, void *user_data)');

Binary file not shown.

Binary file not shown.