xcall MIAMEX, MX_SETMEMFLAGS, idx, flags
MX_SETMEMFLAGS (MIAMEX 163) is used to change the flags for a memory module.
Parameters
idx (Num) [in]
should be set to 0 to reference the memory module for the currently running program or subroutine, or else it can specify the module previous located in a call to MX_USRMAP.
flags (Num) [in]
are the new flags (overriding the previous ones). If you just want to turn on or off a particular flag but leave existing flags alone, you should first retrieve the existing flags using the MX_USRMAP call.
Comments
If you want to use this call within an SBX to cause the SBX to be deleted from memory on exit (instead of being retained as part of the normal caching scheme), then set FLAGS = USRMEM_INUSE. If you do not have that flag set, the module could be deleted by a subsequent memory operation even while the program is running, which would be bad.