Linkers and Loaders: how to (if possible) specify relative path for shared library to the loader

Hi,

first of all I apologize if this is not the right section to post this question, but I didn't
know where else to post it.

I've developed an application which uses a shared library developed by me.

Basically I want to give both the application and the shared library without the source,
and avoiding any installation process.

What I'd like to achieve is to provide a zip packet, which when unpacked, without doing
anything else, can run the application right away.

My problem is how to tell the loader to look for the shared library used in a relative path (perhaps the same of the application (working directory).

Usually you have to tell the loader which directory to look for for the library you want to use, by listing the directory in its .conf file (ld.so.conf), but I want to avoid this.

Is this possible to do? If so, how?

The working environment is of course Linux.

Any hint would be appreciated.

Regards,
S.

Have you tried setting LD_LIBRARY_PATH?

What does ldd show for your executable? (when you run it with the shared library in the same directory)

No I haven't. You mean I should set LD_LIBRARY_PATH in the main executable to add
the relative path based on it's current directory? I'm not sure it'll work if the loader
resolve all symbols at loading time or until the point they are used.

Not found, as the current directory is not set by default in the LD_LIBRARY_PATH.

Thanks,
S.