Libs that return a pointer

BlitzMax Forums/BlitzMax Programming/Libs that return a pointer

How do I do that?

I tried setting up a vector type and making the function return that. It actually worked, though mem offsets are off:

This code displayed "3", meaning that there are two hidden "fields" from the type pointer. I think this is probably a terribly unstable method:
dBodySetPosition box,1,2,3

Type TVector3
	Field x#,y#,z#
EndType

Local position:tvector3'Byte Ptr
position=dBodyGetPosition(box)
Notify position.x


-- EDIT --

This seems to work:
Type TVector3
	Field x#,y#,z#
EndType

world=dWorldCreate()
geom=dCreateBox(0,100,100,100)
box=dbodycreate(world)
dgeomsetbody geom,body
dBodySetPosition box,1,2,3

Local hposition:Byte Ptr
hposition=dBodyGetPosition(box)
Local position:tvector3
(Byte Ptr Ptr Varptr position) [ 0 ]=hposition-8