BlitzMax Extended  0.8.19
Pushing Blitz to the Max.
Functions
blitz_handle.h File Reference

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.
BBObjectbbHandleToObject (BBInt handle)
 Gives the object associated with an integer handle.
void bbHandleRelease (BBInt handle)
 Releases the internal hash for the handle.

Detailed Description

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.

Author:
Mark Sibly

Function Documentation

BB_BEGIN_DECLS BBInt bbHandleFromObject ( BBObject obj)

Gives an integer handle for an object.

If the given object already has an integer handle, the existing one is returned.

Parameters:
objThe class instance to use
Returns:
A integer handle representing the given object, or '0' in case the parameter points to bbNullObject.
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.

Parameters:
handleAn integer handle of an object
BBObject* bbHandleToObject ( BBInt  handle)

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.

See also:
bbHandleFromObject
Parameters:
handleAn integer handle of an object
Returns:
A pointer to the associated object, or BBNULL in case the handle was not created yet.