IDirectDraw *DynamicDirectDrawCreate(void) {
typedef HRESULT (WINAPI *DirectDrawCreateFunc)
(
GUID FAR *guid,
IDirectDraw FAR **device,
IUnknown FAR *unknown
);
HMODULE library;
DirectDrawCreateFunc create;
IDirectDraw *device;
library = LoadLibrary("ddraw.dll");
if(!library) {
return NULL;
}
create = (DirectDrawCreateFunc) GetProcAddress(library, "DirectDrawCreate");
if(!create) {
return NULL;
}
create(0, &device, 0);
return device;
}