boostorg / dll

Library for comfortable work with DLL and DSO
https://boost.org/libs/dll
52 stars 43 forks source link

Add constructor taking native_handle_t #72

Open tgmatos opened 2 months ago

tgmatos commented 2 months ago

Calls to dlopen() will always fail on FreeBSD if ambient authority is disabled (i.e. process is in capsicum mode). For these cases, FreeBSD offers fdlopen(). The new constructor allows the user to explicitly call fdlopen() and then use Boost.DLL to manage the loaded plugin.

Android's libc (Bionic) also has fdlopen(), but under a different name: android_dlopen_ext().

As Linux implements a sandboxing model closer to Capsicum (that's already planned in the roadmap for the Landlock subsystem), similar restrictions will hit glibc and we might see fdlopen() in glibc as well.

This patch resolves issue #69

(This patch was made by a friend of mine and I am just submitting it.)