Skip to content

limbahq/binreloc

Repository files navigation

Short description

BinReloc is a Linux library for creating relocatable applications and libraries.

The problem

The Listaller project (http://listaller.tenstral.net) supports relocation. This means that a package can be installed to any location, like how Win32 installers let you choose a directory. However, most applications are not relocatable. The paths where in they search for data files are usually hardcoded at compile time.

On Win32, applications and libraries are easily relocatable because argv[0] is always a full path to the executable. For libraries, the DllMain() DLL initialization function provides a unique DLL handle. One can use that handle to obtain the DLL's full path.

On Linux however, no easy mechanisms exist. argv[0] is not a full path, but equals what the user typed at the command prompt. For executables, you can still find your full location by resolving the symlink /proc/self/exe, but that won't work for libraries.

The solution

This is why BinReloc is created. BinReloc provides an easy-to-use API that uses all kinds of dynamic linker and kernel magic to find out the full path of your executable or library. BinReloc is meant to be included in your project and adds no dependancies that you don't want.

Please go to http://listaller.tenstral.net/docs/chap-Listaller-App-Development.html#sect-Listaller-App-Development-Relocation for a complete guide.

About

Library for creating relocatable software

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published