LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Possible to make a application module similar to LKM? (https://www.linuxquestions.org/questions/programming-9/possible-to-make-a-application-module-similar-to-lkm-861510/)

yaplej 02-08-2011 07:42 PM

Possible to make a application module similar to LKM?
 
Hey everyone,

Is it possible to create a loadable module for a C app that could be loaded into the app in runtime from a CLI or web interface?

I would like the code to handle a particular type of structure to be "swappable" for lack of a better term. This would allow different modules to be used based on the users wants without having to mess with code. A different module could be downloaded into the application directory then loaded. Basicaly the code would be handed a pointer process it then return it.

Thanks.

Nominal Animal 02-08-2011 09:58 PM

Of course. It is called dynamic linking.

See the dlopen man page for details. It even has an example program. In your case, you won't load libm.so, but your own module. The modules you compile of course as dynamically loadable libraries.

Hope this helps,
Nominal Animal

yaplej 03-19-2011 11:06 PM

Thank you. That is exactly what I was looking for. I thought I had already posted my thanks but I must have spaced it somehow. Thanks again.


All times are GMT -5. The time now is 08:57 PM.