finish C++ support, fix compile in C