Page 1 of 1
4.0B3: Crash when sending a QWORD (q) to dll.
Posted: Thu Feb 16, 2006 7:33 pm
by spacefractal
Code: Select all
ProcedureDLL BASS_setPosition(handle.l,secs.l)
sec.q
flo.f=1.0
sec=CallFunction(BASS_ID,"BASS_ChannelSeconds2Bytes",handle,flo) // position in sec
sec=sec*secs
CallFunction(BASS_ID,"BASS_ChannelSetPosition",handle,sec) // crash
EndProcedure
Here is the BASS document how to use setposition function (where sec is a QWORD):
- BOOL WINAPI BASS_ChannelSetPosition(
DWORD handle,
QWORD pos
);
So how can I pass a QWORD with the new type?
Posted: Thu Feb 16, 2006 7:35 pm
by Fred
Callfunction can't be used for this, you will have to use a prototype to achieve this (or split the quad argument in 2 long, hi/low).
Posted: Thu Feb 16, 2006 7:43 pm
by spacefractal
Do you have a plan to support that in the next beta?
Otherwice how do I do with that prototype or split convertning (another workaround)?
Posted: Thu Feb 16, 2006 8:01 pm
by Fred
CallFunction() is kept only for backward compatibility, prototypes are much more flexible, so it's the way to go.
Ex:
Code: Select all
Prototype.l BASS_ChannelSetPositionPrototype(a.l, b.q)
BASS_ChannelSetPosition.BASS_ChannelSetPositionPrototype = GetFunction(#id, "BASS_ChannelSetPosition")
BASS_ChannelSetPosition(arg1, arg2)
Posted: Thu Feb 16, 2006 8:56 pm
by spacefractal
Got it to work

, Prototypes is the way to go.
Please update the manual, when you made the 4.0 final. I diddent know about it and have oversaw that thing.
You may want to move this topic to "Coding Questions", if you want.
Posted: Fri Feb 17, 2006 12:54 am
by dontmailme
Fo you have an example which returns a float but has no parameters ?
I have :-
prototype.f funcP()
func.funcP=getfunction(DLL, "func")
debug func
This will show 0 when the result should be 0.3
What am I doing wrong ?
Posted: Fri Feb 17, 2006 1:18 am
by Fred
you miss the parentheses, you're calling a function here:
Posted: Fri Feb 17, 2006 8:06 am
by dontmailme
Yes, I realise that Fred

, but see below
Now I have managed to get it to work, I did have the openlbrary, prototype and getfunction in an include file and when I do this it fails when the debug func() is run from the main source with the error.... is not a function etc...
My include file must have a bug!
But it doesn't seem to matter, with or without the () I get the same result, the parenthesis are not required !!! , unless there are parameters to pass.