Use extern "C" to be able to link with C++ code

Signed-off-by: Simon Busch <morphis@gravedo.de>
Rework for a subscription based model

Signed-off-by: Simon Busch <morphis@gravedo.de>