cpperrno.cpp
| 1 | /* begin cpperrno.cpp */
|
|---|---|
| 2 | namespace {
|
| 3 | |
| 4 | #pragma GCC visibility push(default) |
| 5 | #include <errno.h> |
| 6 | #pragma GCC visibility pop
|
| 7 | |
| 8 | void innamespace() {
|
| 9 | errno = EINVAL; |
| 10 | } |
| 11 | |
| 12 | } /* end namespace */
|
| 13 | |
| 14 | extern "C" { |
| 15 | |
| 16 | void seterrno() {
|
| 17 | innamespace(); |
| 18 | } |
| 19 | |
| 20 | } /* end extern */
|
| 21 | |
| 22 | #include <stdio.h> |
| 23 | #include <errno.h> |
| 24 | |
| 25 | int main() {
|
| 26 | seterrno(); |
| 27 | printf("errno = %d\n", errno);
|
| 28 | return errno;
|
| 29 | } |
| 30 | /* end cpperrno.cpp */
|