Jump to content

  • Log In with Google      Sign In   
  • Create Account

DLL Symbols Entity Framework


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 ChaseRLewis   Members   -  Reputation: 140

Like
0Likes
Like

Posted 16 April 2014 - 11:20 AM

I'm not wanting to get full type information or anything crazy. I just am interested in creating a data driven design for my entities. Thing is I have NO idea how to get an enumeration of the DLL function names in Windows. I'm looking at stuff like DbgHelp and other stuff, but the documentation is pretty poor and I'm having a hard time figuring out how to enumerate it.

 

What I'm trying to do:


class GameComponent
{
protected:
virtual void XMLSave(XMLDocument& doc,XMLElement* parent) = 0;
virtual GameComponent* XMLLoad(XMLElement* node) = 0;
public:
virtual const int TypeID() = 0;
virtual const char* Name() = 0;
virtual void Update(){}
virtual void Initialize(){}
//etc...
};

Idea is a search through the symbol list when the engine initializes so that I can build a list of XMLSave, XMLLoad functions without having to hard code a static list of them. Also will allow me to be able to make additional dlls in the future and extend it.

class GameComponentFactory
{
private:
map<const char*,delegate<GameComponent*(XMLElement*)>> ComponentLoadMap;
public:
void Initialize(const char* dllPath);
Scene* LoadXMLFile(const char* path);
}

void GameObjectFactory::Initialize(const char* dllPath)
{
   /*
      How do you load the table?
   */
   vector<string> enumerations = LoadDLLExportTable(dllPath);

   /*
      Determine if class is derived from GameComponent ...
      if so add to the map functions that belong to the main game loop
      and xml load / save files.
      I've read papers that said they've done this ... I just have no clue how.
   */
}

Scene* GameComponentFactory::LoadXMLFile(const char* path)
{
/*
   Psuedo-code would need to be much more safe
*/
   XMLDocument doc;
   doc.Open(path);
Scene* scene = ResourceManager::NewScene();
for(auto obj = doc->FirstChildElement();obj;obj->NextSiblingElement())
{
   GameObject* go = new GameObject(obj->Name());
   for(auto component = obj->FirstChildElement();component;component->NextSiblingElement())
    {
       go->AddComponent(ComponentLoadMap[component->Name()](component));
    }
    scene->AddGameObject(go);
}
  return scene;
}

Edited by ChaseRLewis, 16 April 2014 - 12:57 PM.


Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS