add C interface for nice error handling, causes exceptions in script