![]() |
BlitzMax Extended
0.8.18
Pushing Blitz to the Max.
|
Accessing objects through internally stored handles. More...
#include "_common.h"
Go to the source code of this file.
Functions | |
BB_BEGIN_DECLS BBInt | bbHandleFromObject (BBObject *obj) |
Gives an integer handle for an object. | |
BBObject * | bbHandleToObject (BBInt handle) |
Gives the object associated with an integer handle. | |
void | bbHandleRelease (BBInt handle) |
Releases the internal hash for the handle. |
Accessing objects through internally stored handles.
Handles can be used to access objects from out of BlitzMax. Since the handles are simple integers, they can be used by about any programming language.
Since BlitzMax is garbage collected, simply casting the BBObject* to an integer could cause errors, since the GC would have no knowledge of the external usage and would collect objects that are still used.
Gives an integer handle for an object.
If the given object already has an integer handle, the existing one is returned.
obj | The class instance to use |
void bbHandleRelease | ( | BBInt | handle | ) |
Releases the internal hash for the handle.
This releases the internal integer handle as well as the object associated with it.
handle | An integer handle of an object |
Gives the object associated with an integer handle.
This function only retrieves a pointer to an object previously created by a call to bbHandleFromObject. Any non-existant handles will always result in a BBNULL as a return value.
handle | An integer handle of an object |