File tree Expand file tree Collapse file tree 2 files changed +4
-0
lines changed 
test/addons/dlopen-ping-pong Expand file tree Collapse file tree 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;
2626void  LoadLibrary (const  FunctionCallbackInfo<Value>& args) {
2727  const  String::Utf8Value filename (args.GetIsolate (), args[0 ]);
2828  void * handle = dlopen (*filename, RTLD_LAZY);
29+   if  (handle == nullptr ) fprintf (stderr, " %s\n " dlerror ());
2930  assert (handle != nullptr );
3031  ping_func = reinterpret_cast <ping>(dlsym (handle, " dlopen_ping" 
3132  assert (ping_func != nullptr );
Original file line number Diff line number Diff line change @@ -9,12 +9,15 @@ const path = require('path');
99const  os  =  require ( 'os' ) ; 
1010
1111const  bindingPath  =  require . resolve ( `./build/${ common . buildType }  ) ; 
12+ console . log ( 'process.dlopen:' ,  bindingPath ) ; 
1213process . dlopen ( module ,  bindingPath , 
1314               os . constants . dlopen . RTLD_NOW  |  os . constants . dlopen . RTLD_GLOBAL ) ; 
15+ console . log ( 'module.exports.load:' ,  `${ path . dirname ( bindingPath ) }  ) ; 
1416module . exports . load ( `${ path . dirname ( bindingPath ) }  ) ; 
1517assert . strictEqual ( module . exports . ping ( ) ,  'pong' ) ; 
1618
1719// Check that after the addon is loaded with 
1820// process.dlopen() a require() call fails. 
21+ console . log ( 'require:' ,  `./build/${ common . buildType }  ) ; 
1922const  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 \. $ / ; 
2023assert . throws ( ( )  =>  require ( `./build/${ common . buildType }  ) ,  re ) ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments