Have you tried to add padding at the end of your to your struct?
I am quite sure that class data must be on the same size both on
Windows and on Mac.
Maybe something like:
struct HIDManager_Data
{
Boolean Initialised;
#if TARGET_OS_WIN32
LPDIRECTINPUT8 myDirectInput8Object;
GUID* GUIDArray; // will store the array of
current GUIDs
UInt32 NumberOfDevices;
#elif
// assuming that LPDIRECTINPUT8 and GUID are 4 bytes each
char pad[12];
#endif
};
---
Marco Bambini
http://www.sqlabs.net
http://www.sqlabs.net/blog/
On Apr 21, 2006, at 9:37 AM, Dave Addey wrote:
Hi all,
I’m having an incredibly frustrating problem, which probably means
I’m doing
something stupid.
I have a class, HIDManager, which has the following data setup:
struct HIDManager_Data
{
Boolean Initialised;
#if TARGET_OS_WIN32
LPDIRECTINPUT8 myDirectInput8Object;
GUID* GUIDArray; // will store the array of
current GUIDs
UInt32 NumberOfDevices;
#endif
};
typedef HIDManager_Data* HIDManager_DataRef;
...and the class has the following constructor:
static void HIDManager_Constructor (REALobject instance)
{
ClassData (HIDManager, instance, HIDManager_Data, me);
me->Initialised = false;
#if TARGET_OS_MAC
if (RebuildDeviceList(instance) == noErr) {
me->Initialised = true;
}
#elif TARGET_OS_WIN32
// blank the GUID list
me->GUIDArray = NULL;
// reset the count
me->NumberOfDevices = 0;
// create the DirectInput object
HRESULT osErr = DirectInput8Create(GetModuleHandle(NULL),
DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&me-
>myDirectInput8Object,
NULL);
if (osErr == noErr) {
me->Initialised = true;
CountDevices(instance);
RebuildDeviceList(instance);
}
#endif
}
What I am finding is that the “me->NumberOfDevices = 0” line causes
the
following error (for a Win32 app, built using this plugin and RB
2006r1 on
Mac OS X) when the built application quits:
Runtime Error 4: Failed Assertion
Dump.cpp: 111
Failure Condition: 0
Overwrote start of block
If I comment out this line, everything works fine without the failed
assertion.
Any idea what could be causing this? I can manipulate the
Initialised and
GUIDArray values fine.
Thanks in advance for any help!
Dave.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>