On the other hand, maybe this is somewhat overcomplicated for your needs. Another solution would be to just have a single class with storage for the class defintion pointer. Then when you create a new class, you instantiate an object of that class, populate the storage, and simply add_object_constant() it to the new class. With this solution you'll need an identifier for the constant, but you can hide it with ID_STATIC|ID_PRIVATE. If you add the constant immediately after start_new_program(), and don't set any fancy flags on the program itself, the object should appear as p->constants[0].sval.u.object.