Add pid parameter to writeScratch
debug.h compile++
drop useless cast
wrap json.h in extern C