Help with shared libraries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




I want to create an application that has modules. Whenever I wish to expand it, I simply create another module. I don't want to have to recompile the blasted application.

This led me to thinking about shared libraries. My idea is to create any number of shared libraries, each being a "module." (A module contains a single class.) I drop the .so file into a special directory that my app looks at for shared library files. My app loads each "module" it finds at startup. Each module provides a well-known function which my main app calls to get an idea of what the module can do. My app then instances the proper class from one of the modules and continues on from there.

First, is there any complete information on how to really create and use share libraries? Second, does this description sound even reasonable for the use of shared libraries? If not, can someone point me at something that is reasonable for on-the-fly module loading?

If I am on the right track, then I've been successful at creating the shared library. I know I must use dlopen(). But I cannot understand what dlsym() is suppose to be used for. And, how would I specify to dlsym() the constructor of my class that's in the shared library? I cannot fathom what its symbol's string representation might be. (I'm using gcc 3.2.3 if it makes any difference.)

 Shane



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux