Caché provides the $COMPILE function to convert an array of of source code strings into object code. The object parameter allows you to save the binary object data into a local array variable without affecting any global arrays.
The documentation explains that you can replace the data in ^rOBJ(routine) for the routine with the lines returned in the object parameter and that will change the program that runs for routine.
My question is, can I run the object array directly without modifying any globals (e.g. saving the lines in ^rOBJ first)? My code strings are generated dynamically by external applications and cannot be pre-loaded into routines.
I want to limit the access the calling program has to the overall system. Having access to modify ^rOBJ means being able to change application routines that control the system. It also means that I would have to maintain a bunch of temporary routines, making sure that they get cleaned up in an external process even if the job terminates unexpectedly.
Currently, I am using XECUTE to just run the code lines directly, but I would rather use compiled code as it is faster.