Page 1 of 1
PB4.30 - Libraray Invalid address (CallFunction) Win & L
Posted: Mon Oct 27, 2008 3:51 am
by Inner
Code: Select all
Global fmod_libraryh
fmod_libraryh=OpenLibrary(#PB_Any,"api/libfmod-3.75.so")
Procedure FSOUND_Init(mixrate.l,maxsoftwarechannels.l,flags.l)
Debug fmod_libraryh
ProcedureReturn CallFunction(fmod_libraryh,"FSOUND_Init",mixrate,maxsoftwarechannels,flags)
EndProcedure
Courses and invalid memory access, when clearly it isn't.
Previous Versions it exists in;
v4.30 (all betas) (Windows & Linux)
v4.20
v4.10
v4.00 beta 2
Posted: Mon Oct 27, 2008 7:08 am
by Inner
Code: Select all
fmod_libraryh=OpenLibrary(#PB_Any,"../libfmod-3.75.so")
Debug fmod_libraryh
Global *FSOUND_Init=GetFunction(fmod_libraryh,"FSOUND_Init")
Debug *FSOUND_Init
Procedure FSOUND_Init(mixrate.l,maxsoftwarechannels.l,flags.l)
CallFunctionFast(*FSOUND_Init,mixrate,maxsoftwarechannels,flags)
;ProcedureReturn
EndProcedure
FSOUND_Init(44100,32,0)
This fails also, it would appear that using any of the "Call*" functions within a procedure fails.
Posted: Mon Oct 27, 2008 9:23 am
by Inner
Use callcfunctionfast in procedures? this is odd and doesn't make much sense when we can use;
Code: Select all
fmod_libraryh=OpenLibrary(#PB_Any,"api/libfmod-3.75.so")
If fmod_libraryh
mp3.s="/mnt/media/Music/Biography/Tatu/ninja_tune_-_hexstatic.mp3"
CallFunction(fmod_libraryh,"FSOUND_Init",44100,32,0)
fmodstreamh=CallFunction(fmod_libraryh,"FSOUND_Stream_Open",mp3,#FSOUND_MPEGACCURATE,0,0)
CallFunction(fmod_libraryh,"FSOUND_Stream_Play",0,fmodstreamh)
Debug fmodstreamh
Delay(10000)
If fmodstreamh
CallFunction(fmod_libraryh,"FSOUND_Stream_Close",fmodstreamh)
EndIf
CloseLibrary(fmod_libraryh)
Posted: Mon Oct 27, 2008 1:02 pm
by freak
> Use callcfunctionfast in procedures? this is odd and doesn't make much sense when we can use;
It makes perfect sense. You just don't notice the missing stack cleanup outside of a procedure.
If its a cdecl function (which pretty much all linux libraries are) then use CallCFunction().
Better yet, use PrototypeC and GetFunction()
Posted: Mon Oct 27, 2008 2:08 pm
by Inner
Thanks freak