Lightweight codes for C++ classes to be managed by reference counting on C