Issue#27: C interface implementation

following issue #27
Also please use a more elaborative comment. Mentioning that the out buffers should be freed (and with what calls).