Write access to ANSI errno?

  • Thread starter Thread starter Robin Murison
  • Start date Start date
R

Robin Murison

Hi,

I am writing code which needs to run identically on several
platforms including EBCDIC platforms. Currently this is
ANSI C although we are trying to move to ISO C++. Although
we are using some microsoft Unicode extensions.

As part of this I need to reimplement the wheel so that
when I use Unicode input to _tcstol on an EBCDIC platform
for example it gives the correct answer.

_tcstol would normally set the errno in various error
conditions.

I would also like to set the error no. Now on Windows this
in a multithreading or DLL environment this is impossible.

However I do not want to override the whole C RTL just so
that I can use my own Error No and set it as appropriate

The MS help page on errno does not give an ANSI way of
setting errno. Is there a way of setting it more directly?

Any suggestions? And until M S stop spammers from reading
their news servers for suitable email addresses I am not
likely to put a computer readable email address there. So
see below for contact details

Robin M

R M u r i s o n @ g r o u p 1 s o f t w a r e . c o . u k
 
Robin said:
Hi,

I am writing code which needs to run identically on several
platforms including EBCDIC platforms. Currently this is
ANSI C although we are trying to move to ISO C++. Although
we are using some microsoft Unicode extensions.

As part of this I need to reimplement the wheel so that
when I use Unicode input to _tcstol on an EBCDIC platform
for example it gives the correct answer.

_tcstol would normally set the errno in various error
conditions.

I would also like to set the error no. Now on Windows this
in a multithreading or DLL environment this is impossible.

However I do not want to override the whole C RTL just so
that I can use my own Error No and set it as appropriate

The MS help page on errno does not give an ANSI way of
setting errno. Is there a way of setting it more directly?

It's writable, so just assign to it. Note, however, that for dynamically
linked components to observe the same errno and other CRT state such as heap
and file descriptors, they must link to the same CRT DLL.
Any suggestions? And until M S stop spammers from reading
their news servers for suitable email addresses I am not
likely to put a computer readable email address there. So
see below for contact details

Robin M

R M u r i s o n @ g r o u p 1 s o f t w a r e . c o . u k

It is the nature of these newsgroups and Usenet in general that anyone can
access them. There's no way to prevent spammers from harvesting email
addresses here.
 
Back
Top