Issue#27: C interface implementation

following issue #27
@alikh31 OK, please do not rebase next time as it is impossible to follow.