Re: Finding DLL's

new topic     » goto parent     » topic index » view thread      » older message » newer message
irv said...

What is the best cross-platform way for a program to find the location of a specified dll? Or a dll from a list of possible dll's?

By program, I mean a Euphoria program, otherwise I would ask this on a python forum. And by location, I mean on the computer where the program is run.

The best cross-platform method? Don't. Just ask open_dll() for a library and leave it at that. If it fails, it fails.

The "proper" location for shared libraries is entirely platform-dependent.

Windows

  • Application-specific libraries should be stored next to the executable in the Program Files directory. e.g. C:\Program Files\My Application
  • Framework-specific libraries should be stored in that framework's installation directory. e.g. C:\Euphoria\bin or C:\Windows\Microsoft.NET
  • System-wide libraries should be stored in the Windows system directory. e.g. C:\Windows\System32

Linux/BSD

  • This is highly configurable and can change from distro to distro.
  • Default search paths are (usually) /lib, /usr/lib, /usr/local/lib.
  • Paths can be specified by LD_LIBRARY_PATH environment variable, or the executable's own rpath value.

OS X

  • Mostly the same as Linux/BSD but also searches ~/lib by default.
  • Application-specific libraries should be included in the application's own bundle.
  • Also uses environment variables DYLD_LIBRARY_PATH and DYLD_FALLBACK_LIBRARY_PATH.

None of this prevents applications from behaving badly and putting things in strange locations and then opening them dynamically via full path.

What problem are you trying to solve by manually looking for libraries?

-Greg

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu