PDA

View Full Version : Making a plugin-based application...?


Firelark
08-13-2005, 03:06 PM
Hello I want to make a program that can be extended with plugins. The plugins should also be able to call functions and objects in the main app, if this is possible.

Does any one know of a good tutorial or book on making an API? Also I need to know how to compile these plugins, Im using Dev-C++ and MingW compiler.

Im working on windows xp pro.

Any pointers in the right direction is greatly appreciated.

Karl

Stevemeister
08-13-2005, 06:16 PM
Compiler dependent or independent? Dependent is easy, as you can use any compiler you want and use any of its language/compiler features. Typically you make a DLL with shared classes and functions and link these to both your app and plugin. When the app wants to load a plugin, it calls a plugin entry point function (with no name mangling) that must exist for every plugin. The plugin then modifies data passed from the entry point function.

Independent is harder, as you have to be careful you don't use any compiler-specific language features/keywords. You also have to be wary of any compiler settings as well. For example, last I used Borland C++ (version 5, not Builder), it treated static variables in DLLs differently than VC++ (though you could change this behavior in the compiler settings). You just have to watch out.

Firelark
08-13-2005, 07:16 PM
Thanks Stevemeister, your explanation makes alot of sence. Ive been looking around for tutorials on the internet and found some on how to make DLL's and I actually managed to make and use a dll, but these tutorials are very basic and dont explain the compiler options very well nor do they go into API implementation techniques. Do you know of any tutorials or books on the matter?

Karl

iC4
08-14-2005, 08:29 AM
there are some articles at codeproject

http://www.codeproject.com/info/search.asp?cats=2&searchkw=dll&Submit1=Search&author=&sd=11%2F15%2F1999&ed=8%2F13%2F2005

Firelark
08-14-2005, 10:29 AM
Thanks Thomas, that seems to be a useful link.

CGTalk Moderation
08-14-2005, 10:29 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.