Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007893OCamldynlink and natdynlinkpublic2019-01-05 13:222019-01-06 17:33
Reporterprogman 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
Platformrpi3OSraspbianOS Versiondebian 18
Product Version4.07.1 
Target VersionFixed in Version 
Summary0007893: patch of byterun/unix.c to bring native runtime inline with bytecode in regards to plugin reloading
Description*** unix.c.dlltest 2019-01-05 07:26:44.459916955 +0000
--- unix.c 2019-01-05 08:22:05.729915688 +0000
***************
*** 273,278 ****
--- 273,282 ----
  
  void * caml_dlopen(char * libname, int for_execution, int global)
  {
+ //check whether already loaded
+ void* handle= dlopen(libname, RTLD_NOW | RTLD_NOLOAD);
+ if(handle)//it is so unload first as code is not otherwise actually loaded again
+ if(dlclose(handle) || dlclose(handle)) return NULL;
    return dlopen(libname, RTLD_NOW | (global ? RTLD_GLOBAL : RTLD_LOCAL));
    /* Could use RTLD_LAZY if for_execution == 0, but needs testing */
  }
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0019531)
progman (reporter)
2019-01-05 13:30

bytecode plugins can be edited, re-compiled and re-loaded into a running program.
with native the operation appears successful but does not in fact reload the
code.
the patch checks for presence of said plugin and unloads it to ensure
a code refresh.
two dlclose()'s are required (docs say 1 close each open, and RTLD_NOLOAD still
(in practice) increments the plugin reference count, hence two)

- Issue History
Date Modified Username Field Change
2019-01-05 13:22 progman New Issue
2019-01-05 13:30 progman Note Added: 0019531


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker