API change: return error messages in arguments instead of get_last_error() to improve multithreaded use.