SymDelTwin Function (ROM Call 0x280)

vat.h

short SymDelTwin (SYM_ENTRY *SymPtr);

Deletes a twin symbol.

SymDelTwin deletes a twin symbol (see SymAddTwin for more info about twin symbols) whose VAT entry is SymPtr. Returns TRUE if the operation was successful, else returns FALSE.

When the TIOS deletes a twin symbol, the current value of the flags SF_GREF1, SF_GREF2, and SF_STATVAR are copied from the twin symbol to the original symbol.

Note: Since the TIOS is not able to get the folder handle with only the SYM_ENTRY structure, it reads the folder address, the number of files in this folder, and the maximum number of files in the folder from the global variables used by SymFindFirst and related functions. If the program changes these variables (for example by simply using SymFindFirst) or if it adds or deletes a symbol in the VAT by itself without using SymAdd and SymDel, SymDelTwin will cause severe data corruption.

The solution is simple: Always call SymFindPtr with the complete name of the twin symbol before calling SymDelTwin; passing 0 to its Flags parameter. Samuel Stearley says that calling LoadSymFromFindHandle after finding the symbol with SymFindFirst and SymFindNext works as well. (However, do not call SymDel to delete twin symbols.)


Uses: HeapFree, HeapRealloc, memmove, _ds32s32, ROM Call 0x5CA
Used by: cmd_archive, cmd_unarchiv, EV_eventLoop, LIO_Receive, OSLinkCmd