File tree 2 files changed +4
-0
lines changed
test/addons/dlopen-ping-pong 2 files changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ static ping ping_func;
26
26
void LoadLibrary (const FunctionCallbackInfo<Value>& args) {
27
27
const String::Utf8Value filename (args.GetIsolate (), args[0 ]);
28
28
void * handle = dlopen (*filename, RTLD_LAZY);
29
+ if (handle == nullptr ) fprintf (stderr, " %s\n " , dlerror ());
29
30
assert (handle != nullptr );
30
31
ping_func = reinterpret_cast <ping>(dlsym (handle, " dlopen_ping" ));
31
32
assert (ping_func != nullptr );
Original file line number Diff line number Diff line change @@ -9,12 +9,15 @@ const path = require('path');
9
9
const os = require ( 'os' ) ;
10
10
11
11
const bindingPath = require . resolve ( `./build/${ common . buildType } /binding` ) ;
12
+ console . log ( 'process.dlopen:' , bindingPath ) ;
12
13
process . dlopen ( module , bindingPath ,
13
14
os . constants . dlopen . RTLD_NOW | os . constants . dlopen . RTLD_GLOBAL ) ;
15
+ console . log ( 'module.exports.load:' , `${ path . dirname ( bindingPath ) } /ping.so` ) ;
14
16
module . exports . load ( `${ path . dirname ( bindingPath ) } /ping.so` ) ;
15
17
assert . strictEqual ( module . exports . ping ( ) , 'pong' ) ;
16
18
17
19
// Check that after the addon is loaded with
18
20
// process.dlopen() a require() call fails.
21
+ console . log ( 'require:' , `./build/${ common . buildType } /binding` ) ;
19
22
const re = / ^ E r r o r : M o d u l e d i d n o t s e l f - r e g i s t e r \. $ / ;
20
23
assert . throws ( ( ) => require ( `./build/${ common . buildType } /binding` ) , re ) ;
You can’t perform that action at this time.
0 commit comments