ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I wonder how to read the content of a shared object inside my c/c++ source code. Let me explain more.
Imagine i have a main.c file and it can get 2 int numbers and add them, then i compile this file using gcc and then i have an executable file.
after a while i notice that i like to add subtraction ability(function) to my simple program. there are 4 major way to do it:
1) adding the code inside to source file (main.c) and recompiling it.
2) creating another source file and implementing the new function into it, then compiling it as an static or shared object and the recompiling the main.c against this object file
3) using and embedding an scripting language, say perl or lua, to add the new functionality as scripts files into our executable program. this approach is useful in some situation, but here you have to force the end user to download another program (perl, lua, ...) to be able to run your app correctly, or it would lack a lot of functionalities, though you won't need to recompile your app.
4) embedding a peace of code, i mean new function into main.c to read and deal with the content of a directory, say "./plugin" at runtime and checking if there is any shared library within the directory, if any, reading their contents and adding the extra functionality to the main program on the fly.
so, my question is that how can we implement the fourth approach? in other words, how can we read the content of shared objects on the fly?
Last edited by opengl_cpp; 17 Minutes Ago at 02:07 AM..