Alexandre Julliard wrote:
This is not possible, Winelib doesn't use .a files as import libraries, so even if you somehow generate that .a library it wouldn't do what you expect.
OK. Here is the beginnings of a joystick test. I want to use c_dfDIJoystick2 which is defined as extern in dinput.h and exists in dinput.dll.so but is not exported. It's also not exported in windows dinput.dll but it is in dinput.lib. This test (minus the wine hack) will compile, link (with dinput.lib) and run fine in XP. How do I get the same behavior in wine? I don't think the #include "../data_formats.c" hack is acceptable.
diff -u -N wine.cvs/dlls/dinput/tests/.cvsignore wine/dlls/dinput/tests/.cvsignore --- wine.cvs/dlls/dinput/tests/.cvsignore 1969-12-31 19:00:00.000000000 -0500 +++ wine/dlls/dinput/tests/.cvsignore 2004-09-14 21:08:04.000000000 -0400 @@ -0,0 +1,3 @@ +Makefile +dinput.ok +testlist.c diff -u -N wine.cvs/dlls/dinput/tests/dinput.c wine/dlls/dinput/tests/dinput.c --- wine.cvs/dlls/dinput/tests/dinput.c 1969-12-31 19:00:00.000000000 -0500 +++ wine/dlls/dinput/tests/dinput.c 2004-09-14 21:14:58.000000000 -0400 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2004 Robert Reif + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define STRICT +#define DIRECTINPUT_VERSION 0x0700 + +#define NONAMELESSSTRUCT +#define NONAMELESSUNION +#include <windows.h> + +#include <math.h> +#include <stdlib.h> + +#include "wine/test.h" +#include "windef.h" +#include "wingdi.h" +#include "dinput.h" +#include "dxerr8.h" + +/* FIXME: in windows, you would link dinput.lib to get c_dfDIJoystick2 */ +#include "../data_formats.c" + +static BOOL CALLBACK EnumJoysticks( + LPCDIDEVICEINSTANCE lpddi, + LPVOID pvRef) +{ + HRESULT hr; + LPDIRECTINPUT pDI = (LPDIRECTINPUT)pvRef; + LPDIRECTINPUTDEVICE pJoystick; + + hr = IDirectInput_CreateDevice(pDI, &lpddi->guidInstance, &pJoystick, NULL); + ok(hr==DI_OK,"IDirectInput_CreateDevice() failed: %s\n", DXGetErrorString8(hr)); + if (hr!=DI_OK) + return DIENUM_STOP; + + trace("---- %s ----\n", lpddi->tszProductName); + + hr = IDirectInputDevice_SetDataFormat(pJoystick, &c_dfDIJoystick2); + ok(hr==DI_OK,"IDirectInputDevice_SetDataFormat() failed: %s\n", DXGetErrorString8(hr)); + + /* FIXME: do a bunch more stuff here */ + + return DIENUM_CONTINUE; +} + +static void dinput_joystick_tests() +{ + HRESULT hr; + LPDIRECTINPUT pDI; + + hr = DirectInputCreate(GetModuleHandle(NULL), DIRECTINPUT_VERSION, &pDI, NULL); + ok(hr==DI_OK, "DirectInputCreate() failed: %s\n", DXGetErrorString8(hr)); + if (hr!=DI_OK) + return; + + hr = IDirectInput_EnumDevices(pDI, DIDEVTYPE_JOYSTICK, EnumJoysticks, pDI, DIEDFL_ALLDEVICES); + ok(hr==DI_OK,"IDirectInput_EnumDevices() failed: %s\n", DXGetErrorString8(hr)); +} + +START_TEST(dinput) +{ + dinput_joystick_tests(); +} diff -u -N wine.cvs/dlls/dinput/tests/Makefile.in wine/dlls/dinput/tests/Makefile.in --- wine.cvs/dlls/dinput/tests/Makefile.in 1969-12-31 19:00:00.000000000 -0500 +++ wine/dlls/dinput/tests/Makefile.in 2004-09-12 18:40:09.000000000 -0400 @@ -0,0 +1,14 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +TESTDLL = dinput.dll +IMPORTS = dinput ole32 user32 kernel32 +EXTRALIBS = -ldxguid -luuid -ldxerr8 + +CTESTS = \ + dinput.c + +@MAKE_TEST_RULES@ + +### Dependencies: