how to call shared library from within a C program
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
how to call shared library from within a C program
Hello List,
I need to call a C program from web(cgi-bin).This program depends upon an SDK in the form of binary shared library.But on the target machine which is hosted web-site,the hosting provoder is not willing to place them there.Neither is he willing to include the library path in ld.so.conf.
This is a quick question.I want to know if it is possible for a C program to call it's shared library by itslef into memory?
OR Can a shared library be compiled into a binary?
As I have not done this before,I am asking the question.Any help will be great.
If you link with the -static option when you build your program, everything which is used will be copied from shared libraries into your executable. Of course the executable will be larger than if it is shared, but it should run regardless of the available shared libraries on the target system.
I tried your suggestion.gcc complains it cannot find the library when I use the option '-static'.The files are *so files.I tried by giving full name of the files.If I omit it without changing any other option,it compiles fine. So, my syntax is right.Am I missing something here?
I do not have *.a library files which is not provided by the SDK.And I have no privilege to place these *.so files in standard library path on the target system which is at the root of my difficulty.
But this is solved by -wl,-R/path option to the gcc
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.