Updated some C-style functions so they can be called from c++ sources