extern C and define basename for repl