add C++ api for xs