Make error codes platform-dependent (fixes issue #12)