Purebasic-Tipps and Code > Purebasic Tipps
Using a Purebasic DLL from Powerbasic - Return LONG Values BYREF
(1/1)
Theo Gottwald:
In this case we want to return 3 Values "byref" from the Purebasic-32 but written DLL.
On the Purebasic Side it looks like this:
--- Code: ---ProcedureDLL.l Read_Joystick(No.l,Pad.l,Mode.b,*x,*y,*z)
Protected.l T01,xr,yr,zr
ExamineJoystick(No)
If *x
xr=JoystickAxisX(No,Pad,Mode)
PokeL(*x,xr)
Else
xr=0
EndIf
If *y
yr=JoystickAxisY(No,Pad,Mode)
PokeL(*y,yr)
Else
yr=0
EndIf
If *z
zr=JoystickAxisZ(No,Pad,Mode)
PokeL(*z,zr)
Else
zr=0
EndIf
T01=JoystickButton(No,1)
ProcedureReturn T01
EndProcedure
--- End code ---
--- Code: ---' Sample calling a Purebasic DLL from Powerbasic, returning 4 LONG Values "BYREF"
DECLARE FUNCTION Read_Joystick LIB "XYZ.DLL" ALIAS "Read_Joystick" (BYVAL No AS LONG,BYVAL Pad AS LONG,BYVAL MODE AS BYTE,BYREF x AS LONG,BYREF y AS LONG,BYREF z AS LONG) AS LONG
--- End code ---
On the PowerBasic Side we can call directly this function with variables to get the X,Y and Z-Values of the Joystick with that number.
Navigation
[0] Message Index
Go to full version