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?
--- Dinesh Joshi wrote:
If anyone has links / e-books / tutorials which teaches the above using examples then please post them here.
http://www.llnl.gov/computing/tutorials/pthreads/ (that's a little different, though should serve the purpose to some extent)
P.S.: Anybody know a good resource for debugging using gcc, gdb?
Our GLUG-BOM wiki has an introductory tutorial to GDB
http://db.glug-bom.org/wiki/index.php/Debugging_with_GDB
(If the above URL is breaks to multiple lines, navigate to the wiki from http://www.glug-bom.org)
Psst... Java would make this project a bit simpler, though it may not be the ideal choice.
-- FSF-India Fellow Associate http://www.gnu.org.in
Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php
On Sunday 07 January 2007 12:38, Roshan wrote:
--- Dinesh Joshi wrote:
If anyone has links / e-books / tutorials which teaches the above using examples then please post them here.
http://www.llnl.gov/computing/tutorials/pthreads/ (that's a little different, though should serve the purpose to some extent)
P.S.: Anybody know a good resource for debugging using gcc, gdb?
Our GLUG-BOM wiki has an introductory tutorial to GDB
thanks for the links.
(If the above URL is breaks to multiple lines, navigate to the wiki from http://www.glug-bom.org)
Psst... Java would make this project a bit simpler, though it may not be the ideal choice.
Erm... my main aim is to improve my C skills on the Linux platform. I dont want to use Java.
On 1/7/07, Dinesh Joshi dinesh.a.joshi@gmail.com wrote:
- Processes
- Threads
Dig into the howtos, you'll surely get something on these too.
- Plugins
This got me started on dynamically loaded libraries.
http://www.faqs.org/docs/Linux-HOWTO/Program-Library-HOWTO.html
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?
Yes, a common interface is key to pluggability.
Regards,