copied enforcetreehelper into ctypesystem
added a test case for recursive structs