code for C interfaces and implementations