DirectX and Wine
François Gouget
fgouget at codeweavers.com
Thu Apr 26 16:09:25 CDT 2001
R Kadijk wrote:
>
> I'm having problems compiling and linking a simple DirectX program with Wine.
> The problem is: a global variable c_dfDIMouse should be declared in dinput.h
> and defined in library dinput.
> c_dfDIMouse really is declared in dinput.h, but it seems that c_dfDIMouse is
> not declared in library dinput.
> During linking I get the error: undefined reference to `c_dfDIMouse'.
> Anyone got a clue?
Well, there seems to be a couple of problems:
* First the variable is not defined in the dinput library. So you will
probably need to add something like this in one of the dinput files:
const DIDATAFORMAT c_dfDIMouse;
But then it will need to be initialized somehow. How is one supposed
to get/set its value in DirectX (I don't know DirectX)? Where does its
value come from?
* then this variable should be declared in 'dlls/dinput/dinput.spec' so
that Windows applications can use it. A line like the following should
do it:
@ extern c_dfDIMouse c_dfDIMouse
* but the above will not help you for your Winelib application. Winelib
apps cannot import variables from a 'dll'. So what you must do is either
modify your code to invoke a standard DirectX API that would return the
information you need. Or define a couple of macros so that using
c_dfDIMouse invokes a function returning the address of that variable
and then dereferences it. The whole thing would then look like that:
include/dinput.h:
extern const DIDATAFORMAT* c_dfDIMouse();
#define c_dfDIMouse (*__dinput_c_dfDIMouse())
dlls/dinput/xxx.c
DIDATAFORMAT dinput_c_dfDIMouse; /* Plus some code to initialize it */
const DIDATAFORMAT* __dinput_c_dfDIMouse()
{
return &dinput_c_dfDIMouse;
}
dlls/dinput/dinput.spec:
@ extern c_dfDIMouse dinput_c_dfDIMouse
--
François Gouget
fgouget at codeweavers.com
More information about the wine-users
mailing list