[cpp] mark extern vars as extern.  Sort enum index for export