Skip to content
  • Ray Shih's avatar
    Add loadNativeObj and unloadNativeObj · 2782487f
    Ray Shih authored and Marge Bot's avatar Marge Bot committed
    (This change is originally written by niteria)
    
    This adds two functions:
    * `loadNativeObj`
    * `unloadNativeObj`
    and implements them for Linux.
    
    They are useful if you want to load a shared object with Haskell code
    using the system linker and have GHC call dlclose() after the
    code is no longer referenced from the heap.
    
    Using the system linker allows you to load the shared object
    above outside the low-mem region. It also loads the DWARF sections
    in a way that `perf` understands.
    
    `dl_iterate_phdr` is what makes this implementation Linux specific.
    2782487f