Je Rog
Je Rog

Reputation: 6031

How do I instruction ld to look for additional directories with c?

I'm asking the solution in c , NOT command line options.

The reason I'm sure it exists is that Apache can be instructed to loaded .so dynamically:

load modules/mod_perl.so

UPDATE

Isn't it too inefficient if I need to search with dlsym one by one?

Upvotes: 0

Views: 76

Answers (1)

n. m. could be an AI
n. m. could be an AI

Reputation: 120079

If you want to load your own modules dynamically, study the dlopen/dlsym family of functions. That's what Apache uses to load its modules. man dlopen has all the information.

If you want to link against shared libraries, you must use linker command line options to specify where these libraries are. Otherwise your program will not be able to execute. No amount of C programming can help a program that won't even start.

Upvotes: 2

Related Questions