Loading DLL files on the go --- and initializing them

Apr 7 2013 1:12 PM
Hello there,

I'll try to explain this the best I can. I have two projects, my 'main' project that handles the general stuff, and a 'mod' project. What the mod project will do is it will be a communicator for the main project of other 'sub-projects'. This is part of a game I'm working on but the question really isn't game related in terms of how XNA/etc should work.


How it works though, is that I wanted people to be able to inject there own dlls to enhance the game. For example, lets say the game has some basic objects, like starships. Someone comes along and says 'I want guns on those ships!' and develops a DLL addon that would be loaded on startup. What the 'mod' project should do is detect and load any new DLLs, and can be the branch between my main project and the mods that people create.

However, with new projects, DLLs, I don't know how I should actually handle the initialization of new DLL files being injected real-time. So as in the above example, how to load a dll and inject the coding so it's actually used.

If it was known to the main project, I can obviously simply make a manager that initializes and handles it directly, but for this I need something a bit different, a way to plugin dlls on the go so that custom content can be added.

Does anyone have any ideas on how I can do this? Thank you.

Answers (1)