I am using gcc to compile a program which I need to link to a C library with non-standard name; it is called stuff.a instead of libstuff.a.
I cannot change the name of the file (permission issues).
I don’t want to include the full library (i.e. using gcc program.c stuff.a -oprogram)
I want to compile as gcc program.c -L/path/to/library/ -lstuff -oprogram but gcc will not find the library (because it is not called libstuff.a).
I am working on a Linux box.
How can I get the (dynamic) linking done?
EDIT:
Thank you all, and my apologies for a poorly worded question.
I did not even have a shared object (I thought I could link dynamically to an *.a file), so this confused many of you. Again, apologies for my ignorance.
What I ended up doing is creating the shared object in a local directory, appending the location to my LD_LIBRARY_PATH environment variable, and linking again.
It works like a charm (from 1.3M executable down to 5.8K).
Thanks again.
Assuming that a shared object version of the static library does not exist, it might be necessary to create one. Remember that the static library stuff.a is just an ar archive.
This assumes you want to link against it as a shared library and not simply compile it into your binary.