Introduce uv_dlopen_with_flags()#1331
Conversation
Not surprisingly, this new function is used to pass non-default flags to dlopen. To keep backwards compatibility, uv_dlopen() is maintained, which calls dlopen with RTLD_LAZY. For example, this function will be useful when adding support for dlopen flags in Node.js. Note that uv_dlopen_with_flags() is a no-op in windows, which just calls uv_dlopen(). Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
|
I'm still -1. IF you need Unix only support you can use |
|
I must admit I don't really see the point either. It doesn't add anything over dlopen() since you have to pass in platform-specific flags anyway. Why not call dlopen() directly in that case? |
|
Fair enough. However, it does seem a little short sight to provide support for |
|
@saghul @bnoordhuis While working on implementing this in Node exclusively, I came across tihs: https://github.com/dlfcn-win32/dlfcn-win32/blob/master/dlfcn.c#L295. It shows a way to give meaning to RTLD_GLOBAL in Windows. |
|
This appears to have moved to nodejs/node, so I'll close here. |
* add constants for dlopen flags, which are needed for dlopen's flag passing. * introduce an optional parameter for process.dlopen(), allowing to pass dlopen flags (using values from os.constants.dlopen). If no flags are passed, the default behavior is to load the library with RTLD_LAZY (perform lazy binding) and RTLD_LOCAL (symbols are available only locally). PR-URL: #12794 Refs: #4105 Refs: libuv/libuv#1331 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
* add constants for dlopen flags, which are needed for dlopen's flag passing. * introduce an optional parameter for process.dlopen(), allowing to pass dlopen flags (using values from os.constants.dlopen). If no flags are passed, the default behavior is to load the library with RTLD_LAZY (perform lazy binding) and RTLD_LOCAL (symbols are available only locally). PR-URL: nodejs#12794 Refs: nodejs#4105 Refs: libuv/libuv#1331 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This is a new try at extending uv_dlopen to support UNIX dlopen flags. Previous try was rejected and closed: #635.
@saghul reasons for closing were:
First objection is addressed by introducing a new function,
uv_dlopen_with_flags. This is a no-op in Windows.Now, about the Windows behavior objection. Introducing a
uv_dlopen_with_flagsfunction makes portable programs (such as node.js) result in much cleaner code. In other words, we would like to simply calluv_dlopen_with_flagswithout any ugly platform specific ifdef'ery.See ezequielgarcia/node@3820c96 for an example on how this function would be used.
It's important to mention that
uv_dlopenimplementation is maintained, keeping backwards compatibility.