Writing Plug-ins
Morining, can anyone help me with the following problem.
I''m trying to write an application (in C) which will provide support for a selection of internally developed plugins (each plugin will support exactly the same no. of methods so the application doesn''t need any prior knownledge that a plugin exists). However after a quick search around the internet I found absolutly nothing on the topic of how to do this, generally sites only cover how to develop plugins for already available applications.
Can anyone point me in the right direction (source code is preffarble if possible) on how to create an application which can load its own specifically designed plug-ins and execute them. I''m currently following a similar design to the visual plugins (plugins are written as dll files) that Winamp uses however obviously without the source code to winamp I dont know how I can load in the plugins and execute the contained methods.
Thanks in advance Kiel.
Writing a plugin system isn''t at all that difficult. Simply scan for dll files with certain name characteristics (as does WinAmp) - use FindFirstFile() and FindNextFile(). For example, let''s suppose that all the visual pulgins are named v_xxx.dll. Once you''ve listed them in some predefined folder (such as /Plugins/), load each one of them. Your application needs to know the names of the functions in the plugins (read: the plugn needs to have its functions named after some predefined names), or the plugin has to have at least one routine (that the calling application knows) to pass the existing function names to the application. All of the functions in the dll have to be exported properly. Once you''ve loaded and initialized them (by calling GetProcAddress()), you can call each individual function. From there on, it''s all implementation-specific. Use LoadLibrary() to load the dll''s. If you''re not familiar with the concept, yet, you''ll also have to look into function pointers.
PS. This is not the most proper forum for that kind of a thread.
Hope this helps,
Crispy
PS. This is not the most proper forum for that kind of a thread.
Hope this helps,
Crispy
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement