this is obviously a c++ program so why don't you use a c++ container such as to house the plugins? Other than that, its hard to say what your problem is because you did not post enough code. It would be helpful if you just zipped up all the files and attached it to your post.
Ancient Dragon
Retired & Loving It
30,046 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,342
Here is one you should bookmark.
Plugin.h should be using std::string objects instead of char* -- it will make your life a lot easier because you don't need to allocate memory for those strings. Look over your code and see where else you can substitute std::string for char*.
typedef struct _PluginInfo
{
std::string PluginName;
std::string PluginAuthor;
int Flags;
PluginCallback Callback;
} PluginInfo;
Ancient Dragon
Retired & Loving It
30,046 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,342
Here is an example of how to use map. All it does is associate a number with an instance of PluginInfo object.
#pragma warning(disable: 4786)
#include <windows.h>
#include <iostream>
#include <string>
#include <map>
typedef enum _RequestCode
{
cPluginInit = 1,
cPluginQuit = 2
} RequestCode;
typedef long (*ServiceFunc)(UINT, RequestCode, UINT_PTR, ULONG_PTR);
typedef long (*PluginCallback)(RequestCode, UINT_PTR, ULONG_PTR);
typedef struct _PluginInfo
{
std::string PluginName;
std::string PluginAuthor;
int Flags;
PluginCallback Callback;
} PluginInfo;
std::map<UINT,PluginInfo*> theList;
int main()
{
PluginInfo* info = new PluginInfo;
theList[1] = info;
PluginInfo* pinfo = theList[1];
return 0;
}
Ancient Dragon
Retired & Loving It
30,046 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,342