Update SimpleWrapper mechanism to allow recording changes to arbitrary globals, and use this to implement support for the getopt() function.