C driver function