Runtime functions
Initializes a new instance of a registered class
XS_EXPORT XSMutableObjectRef XSRuntimeCreateInstance(
XSClassID classID );
The allocated instance
Initializes a new instance of a class with a specific name
XS_EXPORT XSMutableObjectRef XSRuntimeCreateInstanceOfClassNamed(
const char *name );
The allocated instance
Gets the class type ID for an object
XS_EXPORT XSClassID XSRuntimeGetClassID(
XSObjectRef object );
The class type ID for the object
Gets the class type ID for a class with a specific name
XS_EXPORT XSClassID XSRuntimeGetClassIDOfClassNamed(
const char *className );
The class type ID
Gets the class name for an class type ID
XS_EXPORT const char * XSRuntimeGetClassName(
XSClassID classID );
The name of the class
Gets the class type for an class type ID
XS_EXPORT XSClassType XSRuntimeGetClassType(
XSClassID classID );
The type of the class
Gets an object's description
XS_EXPORT const char * XSRuntimeGetDescription(
XSObjectRef object );
The object's description
Gets the shared instance of a registered class
XS_EXPORT XSObjectRef XSRuntimeGetSharedInstance(
XSClassID classID );
The shared instance if it exists, otherwise NULL
Initializes the XSFoundation runtime
XS_EXPORT void XSRuntimeInitialize(
void );
This function must be called before using any XSFoundation function.
Checks whether a pointer is an object instance
XS_EXPORT bool XSRuntimeIsInstance(
const void *ptr );
True if the pointer represents an instance, otherwise false
Checks whether a class type ID corresponds to a registered class
XS_EXPORT bool XSRuntimeIsRegisteredClass(
XSClassID classID );
True if the class ID represents an valid class, otherwise false
Registers a class for the runtime
XS_EXPORT XSClassID XSRuntimeRegisterClass(
const XSClassInfo *cls );
All runtime classes needs to be registered before the runtime can use them and create instances. This function needs to be called once per class, ie using pthread_once().
The runtime type ID for the class
Registers a finalizer function, to be called when the program exits
void XSRuntimeRegisterFinalizer(
void ( *func )(
void ) );
Based on its address, a finalizer function will only be registered once.