Hey Ash,
Passing the info as Cstring, seems to fix the crash problem [FMOD still
can't find the file, but at least it is not crashing so I have something to
work with to solve those other problems].
Anyway, just wanted to say THANKS. :-)
>> I am totally, clueless at this point. [I am blaming it on my evil
>> cats].
>
> Oh c'mon, cats are cool :-)
Yes I agree in general, they are. At least until they go wandering
through a patch of poison ivy. Then they don't bother to tell you about
that when you go to pick them up and pet them.
[Grumbling, and still scratching 5 days later.]
Peace
Stan
On 5/24/05 1:00 PM, "realbasic-games-request at lists dot realsoftware dot com"
<realbasic-games-request at lists dot realsoftware dot com> wrote:
> ----------------------------------------------------------------------
>
> Message: 1
> Subject: Re: Debug App quits without giving a reason.
> From: Asher Dunn <asher at fireyesoftware dot com>
> Date: Mon, 23 May 2005 19:48:37 -0400
>
>
> On May 23, 2005, at 10:43 AM, Stan Rosenbaum wrote:
>
>>
>> Hey Asher,
>>
>> Your probably right about the string... Here is what I am trying
>> to
>> do.
>>
>>
>> This is the Declare I have made:
>>
>> ====
>>
>> FMODEX.FMOD_System_CreateSound:
>> Protected Function FMOD_System_CreateSound(ByVal SystemFMOD As Integer,
>> ByVal name_or_data As String, ByVal mode As Integer, exinfo As integer,
>> ByRef Sound As Integer) As Integer
>
> ByVal is not needed. If you do not specify ByRef, parameters are passed
> byval by default.
>
>> #if targetWin32
>> #elseif targetLinux
>> #elseif targetMachO
>>
>> Dim result as Integer
>> Dim stringPtr as MemoryBlock
>>
>> stringPtr = FMODEX.stringToMemoryBlock(name_or_data)
>>
>> Declare Function FMOD_System_CreateSound Lib FMODdylibLocation
>> (ByVal System As Integer, name_or_data As Ptr, ByVal mode As Integer,
>> ByRef exinfo As Integer, ByRef Sound As Integer) As Integer
>> result = FMOD_System_CreateSound( SystemFMOD,
>> stringPtr.CString(0), mode, exinfo, Sound )
>>
>> return result
>>
>> #endif
>> End Function
>
> Again, you don't need ByVal. Also, to pass a CString, you can declare
> the parameter as a CString (declare sub foo lib "bar" (data as
> cstring)), and then just pass a string. You don't need to convert it to
> a memoryBlock manually.
> There is another problem here though -- you are passing a CString where
> it expects a pointer. This can cause all sorts of lovely memory
> corruption problems (hence the crash), because the first four bytes of
> the string are being interpreted as a pointer, and the rest of it is
> being discarded. Declare the parameter in the declare statement as
> "name_or_data as cstring", and then pass a regular RB string.
>
>> And this is the "FMODEX.stringToMemoryBlock" helper function,
>>
>> ====
>>
>> FMODEX.stringToMemoryBlock:
>> Protected Function stringToMemoryBlock(stringToConvert as String) As
>> MemoryBlock
>>
>> Dim memBlock as MemoryBlock
>> memBlock = NewMemoryBlock( len(stringToConvert) + 1 )
>>
>> memBlock.CString(0) = stringToConvert
>>
>> return memBlock
>>
>> End Function
>>
>
> This function is unnecessary. Just declare the parameter to the declare
> as a CString and pass an RB string.
>
>> I am totally, clueless at this point. [I am blaming it on my evil
>> cats].
>
> Oh c'mon, cats are cool :-)
>
>> FMOD_RESULT System::createSound( char * name_or_data, FMOD_MODE
>> mode, FMOD_CREATESOUNDEXINFO * exinfo, FMOD::Sound ** sound );
>
> "FOMD::Sound** sound" is a pointer to a pointer to an FMOD::Sound. I
> can't remember how to accommodate this in RB, but it needs special
> consideration.
> Any declare masters hanging around to remember how to do this?
>
> HTH!
>
> Asher Dunn
> --------------------------------------------------------
> President and Head Developer of Fireye Software
> <http://www.fireyesoftware.com/>
> AIM and Yahoo: fireye7517
>
>
> ==================================================
--
This web page is best viewed on a computer.
_______________________________________________
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>
|