(C) 1998 AROS - The Amiga Research OS
Tries to free a class which has been created with MakeClass() in the first place. This will not succeed in all cases: Classes which still have living objects or which are still beeing used by subclasses can't simply be freed. In this case this call will fail.
Public classes will always be removed with RemoveClass() no matter if FreeClass() would succeed or not. This gurantees that after the call to FreeClass() no new objects can be created.
If you have a pointer to allocated memory in cl_UserData, you must make a copy of that pointer, call FreeClass() and if the call succeeded, you may free the memory. If you don't follow these rules, you might end up with a class which is partially freed.
TRUE if the class could be freed. You must not use classPtr after that.
// Free a public class with dynamic memory in cl_UserD int freeMyClass (Class * cl) { struct MyPerClassData * mpcd; mpcd = (struct MyPerClassData *)cl->cl_UserData; if (FreeClass (cl) { FreeMem (mpcd, sizeof (struct MyPerClassData)); return (TRUE); } return (FALSE); }