/* set input vars */ char *string = . . . Set_Global("validate", "QUANTITY", "i", quantity); Set_Global("validate", "ORDERTYPE", "s", ordertype); /* run code string */ status = Run_Codestr(PY_STATEMENT, string, "validate", "", NULL); if (status == -1) PyErr_Print(); /* stack traceback */ else { /* fetch output vars */ Get_Global("validate", "QUANTITY", "i", &quantity); Get_Global("validate", "MESSAGES", "s", &messages); }