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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.