Giter Site home page Giter Site logo

no RTLD_NOLOAD about dlfcn-win32 HOT 6 OPEN

dlfcn-win32 avatar dlfcn-win32 commented on June 14, 2024
no RTLD_NOLOAD

from dlfcn-win32.

Comments (6)

markand avatar markand commented on June 14, 2024 1

It isn't part of POSIX so it should stay out for portability reasons IMHO.

from dlfcn-win32.

pali avatar pali commented on June 14, 2024 1

Proper implementation of dladdr() tool half of year. So it is hard to do it properly and takes lot of manpower and time. Anyway can work on it, prepare pull request, but do not expect that it would be merged quickly... be prepared that people do not have time for review and also that it may take year (or more) for merging...

from dlfcn-win32.

nicowilliams avatar nicowilliams commented on June 14, 2024

What I tend to do is have code like:

#ifndef RTLD_WHATEVER
#define RTLD_WHATEVER 0
#endif

Admittedly that won't do here if you really want to... not load. One thing you can do is dlsym(RTLD_DEFAULT, some_sym_only_in_target_DLL) to check if some symbol you know would only come from that DLL is available, and if it is then you infer that that DLL is loaded. That's not foolproof.

IMO useful extensions should get supported, but if upstream doesn't want them...

from dlfcn-win32.

nicowilliams avatar nicowilliams commented on June 14, 2024

It isn't part of POSIX so it should stay out for portability reasons IMHO.

But @markand, the whole purpose of this repository is enhancing portability by bringing to WIN32 an API that's foreign to it. One could just as well say "don't use POSIX dlfcn on WIN32, use WIN32 native APIs".

Useful extensions to POSIX are still useful, and if widely used, then one tends to build compatible implementations for systems where those extensions are not available.

from dlfcn-win32.

pali avatar pali commented on June 14, 2024

Well, RTLD_NOLOAD is not really part of POSIX and I do not think that it is possible to implement this GNU flag on Windows. So I do not see any reason to implement a new flag RTLD_NOLOAD which would be incompatible with GNU dlopen implementation. Applications would still need to #ifdef code for windows, so it does not bring any value. Just cause problems as people would think that this flag is same as in GNU dlopen which would not be truth.

from dlfcn-win32.

nicowilliams avatar nicowilliams commented on June 14, 2024

FYI, RTLD_NOLOAD is not just GNU, but also BSD (FreeBSD, NetBSD, possibly others, have it) and Solaris/Illumos. Given that, it might as well be POSIX. In any case, presumably you'd accept a PR for more non-POSIX extensions provided they are useful enough and not too complex or whatever criteria were applied to dladdr().

I'm not sure if there's many apps using it, and it's hard to find any with a GitHub code search (GH: please implement negative filters!), but if you search issues it's much easier (there's only 159 hits), one of which tells how to implement RTLD_NOLOAD on Windows:

Basically, GetModuleHandleExW() will not load the DLL if it isn't already loaded, so it can tell you if it's been loaded.

Searching commits instead of code or issues, I find that, e.g., SBCL (a Common Lisp) uses RTLD_NOLOAD. Even so, most references are in clones of bionic and what not.

Also, note the RTLD_NOLOAD | RTLD_GLOBAL combination for promoting an already-loaded object from local to global. This makes RTLD_NOLOAD at least a wee bit less trivial than just calling GetModuleHandleEx().

from dlfcn-win32.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.