facebookincubator / xar

executable archive format
Other
1.57k stars 55 forks source link

does dlopen work ? #10

Closed nareshv closed 6 years ago

nareshv commented 6 years ago

was wondering if this allows dlopen from python code thats xar'd

terrelln commented 6 years ago

Yes, you can dlopen() from a Python XAR. However, in the bootstrapping script we set the $LD_LIBRARY_PATH (and the $PYTHONPATH) to the mounted XAR directory, and will execute from the mounted XAR directory, meaning that Python ctypes will search in the XAR first. If the library isn't present in the mounted XAR root directory, the system libraries will be searched.

Ideally all the shared libraries will be packaged into the XAR so it is independent of the packages installed on the system. If needed the xar.utils.get_runtime_path() function can be used to find the root directory of the XAR.

Note that you can modify the bootstrapping script to suit your needs, since it is just a file that is written into the XAR.

terrelln commented 6 years ago

Closing the issue since the question is answered, feel free to reopen if you have follow up questions.