Convert from byte ptr to object?

BlitzMax Forums/BlitzMax Programming/Convert from byte ptr to object?

HandleToObject should work...
myObject = HandleToObject(Int(myBytePtr))

although I've never used it, funnily enough.

Usually, if I have a void* that lets me store user data, I define it in the Extern function like this:
c code...
extern "C" {
   void setMyData(void * data);
   void * getMyData();
}

max code ...
Extern
    Function setMyData(obj:Object)
    Function getMyData:Object()
End Extern


with wxMax though, I've gone one step further, and now interface with BBObject* instead, in my wrappings...
extern "C" {
   void setMyData(BBObject * data);
   BBObject * getMyData();
}

and cast to (void*) or not, where necessary.

...each to their own :-)