Hi List,
New Year greetings to all!
I am working on a small project and want to learn about implementing simple plugins in C. I have already done some research on plugins. They are generally implemented using dynamic libraries ( dlfcn.h? ).
My project involves taking a simple user command and process it using different algorithms ( based on user's choice ). Each algorithm is implemented as a plugin. The program should launch the plugin in a separate process/thread and wait until it completes the processing. The advantage of this model is that, if required, the program can use several algorithms simultaneously to process the same command.
So I need to learn how to program:
1. Processes 2. Threads 3. Plugins
I know one comprehensive resource is not available to learn all of the above. Any inputs are appreciated. I like to learn by example. If anyone has links / e-books / tutorials which teaches the above using examples then please post them here.
Also, I am a bit confused about how exactly plugins are implemented. In my case, all algorithms perform the same task but internally the processing differs. So do i implement a common API which my main program ( can I call it a server? ) will use to communicate with that plugin? Once the API standardized, can people simply add new algorithms by implementing the same API?
One more dilemma I face is whether to use processes or threads? With the newer multicore ( and the older HT ) architecture processors, what would be better to use? Processes or Threads?
Ofcourse it goes without saying I'm using Linux, gcc :P
P.S.: Anybody know a good resource for debugging using gcc, gdb?