I wonder about create every game engine module (render, input, sound, etc...) into dlls (renderer.dll, input.dll, etc...). What are pros and cons in your opinion of divide game into set of dlls ? I see only need to write game module in separate dll, to have posibility to create mods.
|
|
Putting code into seperate Windows DLLs sounds promosing in theory, but in practice you should be aware of certain limitations.
If you just want to reuse your code without recompiling, there is another option, static libraries (.lib). It is precompiled code (as in the DLL) but it is linked into your application and has no such limitations as the ones mentioned above, plus Link Time Code Generation still works with the library code. Update: As Sean pointed out in the comments, point 2 and 3 can work when using the same CRT version, as the MSDN link in 2 also shows. However, my advice is to design the DLL without relying on it at all, since there are so many cases where it won't work, like using 2 DLLs with different CRT's or compiled with different Visual Studio versions. |
|||||||||||
|
|
Pros
Cons
I do not see sense to have render.dll and input.dll But some RareUsedJoystick.DLL could be made as loadable module to release memory for those who do not use that RareUsedJoystick |
|||||||||||||||||||
|
|
Most differences are negligible. DLL's are more flexible but make the building process more complex. I would only use DLL's if:
|
|||
|
|
|
Another advantage is that it can help you structure your code correctly. Any non-logical dependencies between modules will stand out more and it will be more difficult to use such hacks. |
|||
|
|