Hi Marco,
Yes - that worked! Thank you *very* much - I would never have guessed that
that was the problem, and it was driving me mad :-)
Now I can get back to work!
All the best,
Dave.
> From: Marco Bambini <marco at sqlabs dot net>
> Reply-To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot
> com>
> Date: Fri, 21 Apr 2006 09:45:07 +0200
> To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot com>
> Subject: Re: Accessing an integer value in class constructor is causing failed
> assertion
>
> 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>
_______________________________________________
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>
|