#Lazy relink of dynamic library leads to crash

3 messages · Page 1 of 1 (latest)

split herald
#

Electron Version
20.2.0

What operating system are you using?
macOS

Operating System Version
macOS Monterey

What arch are you using?
arm64 (including Apple Silicon)

Problem:
I compiled a C dynamic library, which exposes some API to do some simple things.
Then, I used ffi-napi to call the APIs in the main.js, like the following:

const ffi = require('ffi-napi');
const ref = require('ref-napi');

const my_dll = new ffi.Library("./lib/libmydll", {
    'set_book_fpath': [
    'bool', ['char*'],
    ],
});

var fpath = new Buffer.from("/Path/To/something/")
fpath = ref.types.char;

const result = my_dll.set_book_fpath(fpath);
console.log("set fpath result:", result);

When I open the MacBook pro, execute electron ., everything goes perfectly.
However, When I just modified the library source code, (i.e. add one line of printf), compiled the dynlib, copied newest dynlib file to the ./lib directory of electron project, executed electron . again, I got:

"Electron exited with signal SIGKILL"

Then I shutdown the macbook, restart it again, electron . goes well again !
I thought the problem is the lack of relinking the recompiled dynlib, how can I solve this problem?

dark oak
#

How did you get past the no build was found for error?