Skip to main content
gamedev.net
🔒 Locked

making tools

Started by sakky 0 replies 300+ views
Original Post
sakky
sakky
I'm writing a plug-in architecture for what ever. I'll use it in a few applications but I'm working on the general framework for now. I'll use it for building editors and stuff for several other projects. Just part of a code depot that I'm creating. So any ways, I've decided to use DLLs as the external modules that house the plug ins. I chose them because they're easy to create and other support issues regarding Win32/MFC. My problem here is communicating between host(main application) and server(DLL). I have a little enumeration function that's implemented by the sever. The server fills the parameters that describe various things about the plug in(s) exsisting in the module. I'm sort of sceptic how DLLs and a main process communicate. If I create local variables in the DLL that describe each plug in and then say I pass a pointer back to the host, wouldn't there be an error here? I'm not getting one from my tests that I've made, but things seam a little off, if you know what I mean. The server needs to tell the host it's name, version and type of each plug in. Oh yeah, it also needs to give the name and address of each plug ins main function. Or actually just the name because that's all GetProcAddress needs. So I've cam up with this... // plug in info typedef struct _plugin_t { char name[ 50 ] ; unsigned short version ; long type ; char main[ 50 ] ; } plugin_t ; // what the server sends the host typedef struct _srvinfo_t { char name[ 50 ] ; long count ; plugin_t* plist ; } srvinfo_t ; I use a name for the entire plug in set for representation to the user or for other purposes. So the host sends the server a srvinfo_t and it fills it with the plug in information. But say, if I had an array of plugin_t structures and I just pointed plist to that array? It works fine, but what if I allocated space for that array via new / malloc. I want to know if there was a better way to transfer information between DLL and application. Is there a better way? Would a global variable work better? What I mean is something like a string. Then all I need to do is access that array of strings.
Take back the internet with the most awsome browser around, FireFox

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.