Explicit Run-Time Linking Library
As I’m continue to work on my long time project. The Ganbatte Engine. This engine is developed by me for my personal projects to get more experience with all the technology popular in the gaming industry that is freely available for personal use.
The Graphics System is actually powered by D3D10 but will change after the release of D3D11 to D3D11. Since D3D11 is based on the D3D10 API it will be very easy to switch, D3D11 will also run on D3D10 hardware.
To make all the different components of the engine more independent I choose to go the way of Explicit run-time linking. So I can change the implementation of a System without having to recompile the application using it.
To make the process a little bit more streamlined and object-orientated(.Net really makes you an object beast
) I developed the small ExplicitRunTimeLinkingLibrary. The library is only one class actually.
As you can see this class is really simple.
Just 5 methods + con- /deconstructor.
The constructor takes just the name of the dll we want to get the function pointer from.
Load()
Loads the dll, returns false if something failed.
Unload()
Unloads the dll, returns false if something failed
GetFunction<T>(string functionName, T* function)
This method is most important function of the class. This method takes a name containing the name of the function we want to get the pointer to.
T* is a pointer to an object of the function signature described through a typedef.
Returns false if something failed.
GetErrorStack()
Returns an std:stack<wstring> data structure containing all the errors.
As you can see the function doesn’t return any information about what failed this information is available here.
Example:
typedef bool (*importGraphicsDeviceFunction)(IGraphicsDevice** device);
DllReflector graphicsDll(L"D3D10GraphicsSystem.dll");
graphicsDll.Load();
graphicsDll.GetFunction<importGraphicsDeviceFunction>("CreateDevice",&createGraphicsDevice);
As you can see very easy and straightforward.
ExplicitRunTimeLinkingLibrary by Jendrik Illner is licensed under a Creative Commons Attribution 3.0 United States License.

