remove useless declaration of globals and prepare for cpp linking