Mike McCormack : ddraw: Don't link to wined3d, load it at runtime.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Aug 3 15:58:24 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: d99c7d59392f96de30f73328c0fe412b83d1b31e
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=d99c7d59392f96de30f73328c0fe412b83d1b31e
Author: Mike McCormack <mike at codeweavers.com>
Date: Thu Aug 3 14:30:00 2006 +0900
ddraw: Don't link to wined3d, load it at runtime.
This lets ddraw dlls built on a machine with OpenGL present run on other
machines that may not have the OpenGL libraries installed.
---
dlls/ddraw/Makefile.in | 2 +-
dlls/ddraw/main.c | 21 ++++++++++++++++++++-
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/dlls/ddraw/Makefile.in b/dlls/ddraw/Makefile.in
index 3e43491..6bbeb1e 100644
--- a/dlls/ddraw/Makefile.in
+++ b/dlls/ddraw/Makefile.in
@@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = ddraw.dll
IMPORTLIB = libddraw.$(IMPLIBEXT)
-IMPORTS = wined3d ole32 user32 gdi32 advapi32 kernel32 ntdll
+IMPORTS = ole32 user32 gdi32 advapi32 kernel32 ntdll
EXTRAINCL = @X_CFLAGS@
EXTRALIBS = -ldxguid -luuid @X_LIBS@ @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@
diff --git a/dlls/ddraw/main.c b/dlls/ddraw/main.c
index a9bec78..e654dd7 100644
--- a/dlls/ddraw/main.c
+++ b/dlls/ddraw/main.c
@@ -48,6 +48,11 @@ #include "d3d.h"
#include "ddraw_private.h"
+typedef IWineD3D* (WINAPI *fnWineDirect3DCreate)(UINT, UINT, IUnknown *);
+
+static HMODULE hWineD3D = (HMODULE) -1;
+static fnWineDirect3DCreate pWineDirect3DCreate;
+
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
/* The configured default surface */
@@ -149,13 +154,27 @@ DDRAW_Create(GUID *guid,
This->orig_width = GetSystemMetrics(SM_CXSCREEN);
This->orig_height = GetSystemMetrics(SM_CYSCREEN);
+ if (hWineD3D == (HMODULE) -1)
+ {
+ hWineD3D = LoadLibraryA("wined3d");
+ if (hWineD3D)
+ pWineDirect3DCreate = (fnWineDirect3DCreate) GetProcAddress(hWineD3D, "WineDirect3DCreate");
+ }
+
+ if (!hWineD3D)
+ {
+ ERR("Couldn't load WineD3D - OpenGL libs not present?\n");
+ hr = E_NOTIMPL;
+ goto err_out;
+ }
+
/* Initialize WineD3D
*
* All Rendering (2D and 3D) is relayed to WineD3D,
* but DirectDraw specific management, like DDSURFACEDESC and DDPIXELFORMAT
* structure handling is handled in this lib.
*/
- wineD3D = WineDirect3DCreate(0 /* SDKVersion */, 7 /* DXVersion */, (IUnknown *) This /* Parent */);
+ wineD3D = pWineDirect3DCreate(0 /* SDKVersion */, 7 /* DXVersion */, (IUnknown *) This /* Parent */);
if(!wineD3D)
{
ERR("Failed to initialise WineD3D\n");
More information about the wine-cvs
mailing list