Usually you will find some of your applications (games?) Of internal interfaces and objects for mod authors. The mod developer will create a dll that uses these objects and interfaces to do something useful. Then the application will dynamically load mod dll and, if necessary, invoke the mod implementation.
Another way to think about your game is the operating system (Windows), and your mod is the application (Word). The OS provides some APIs for creating and managing windows; the application uses them where necessary.
So, as a game, you can create and distribute the following interface:
class Mod {
virtual int takeDamage(int damage);
};
And ask users to provide exported functions for creating and deleting mod objects.
Deploy it:
class GodMod : public Mod {
int takeDamage(int damage) { return 0; }
}
__declspec(dllexport) Mod *create_mod() { return new GodMode(); }
__declspec(dllexport) void delete_mod(Mod *mod) { delete mod; }
DLL (LoadLibrary API Windows), create_mod delete_mod GetProcAddress API. - create_mod , :
int damage = 100;
for (int i = 0; i < mods_count; i++) {
damage = mods[i]->tageDamage(damage);
}
decrease_health(damage);
delete_mod DLL.