GNOME Bugzilla – Bug 172268
Binary relocatability API for glib
Last modified: 2018-05-24 10:35:24 UTC
It'd be nice to have a GetModuleFileName style API in glib that abstracts the different ways a program can locate its own absolute path at runtime. On Windows you can use GetModuleFileName to locate the absolute path of the current process. On Linux reading /proc/self/exe does the same thing. I do not know what the equivalent is on other UNIX systems. One thing I'm not sure about is whether to support libraries or not. Windows and Linux let you determine the absolute path of a library by passing in a pointer to somewhere inside the image, for instance the address of an empty string. Again I am not sure how portable that is outside these two platforms. I hope to write a patch for this in the next few months.
I'm pretty sure this is a duplicate of some other bug, but I can't find it right now.
Looks like there's already an API for the similar g_win32_get_package_installation_directory().
Maybe http://autopackage.org/docs/binreloc/ can help.
Doesn't look like it is going to happen for 2.10
I'm developing some projects that should be portable also to systems other than *nix, and I stumbled upon BinReloc as well as a solution to binary relocatability. Since it has a GLib-style interface, how about adding its API directly to GLib? It would make life a bit easier to us developers, rather than using yet another external tool for this task. KDE guys have already integrated something like that in their libraries. Probably GNOME could benefit too. What about landing them in GLib 2.13.x, for a 2.14 release?
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/31.