Reporting errors from local libraries

Karl Heuer karl at haddock.ima.isc.com
Thu Jun 15 04:23:48 AEST 1989


In article <25447 at agate.BERKELEY.EDU> bks at ALFA.berkeley.edu ( Brad Sherman ) writes:
>If one has N libraries and all functions in these libraries return
>0 on success and -1 on failure, and one wishes, say, to set an (extern)
>integer "Localerrno" to provide additional info on failure, what is the
>guruish way to proceed?  That is, where exactly should the single instance
>of "int Localerrno" appear?

In a separate module.  I.e., create "Localerrno.c" containing the single line
"int Localerrno = 0;" and hope that your linker is smart enough to handle it.

(Unfortunately, if it isn't smart enough, it's probably for what the vendor
believes is a good reason, and so a bug report is likely to be ignored.)

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list