Additional C++ fixes

Important!

This commit must be applied in parallel with the commit that moves their
structs into types.h.  Does not compile otherwise.