| Title: | C++ |
| Notice: | Read 1.* and use keywords (e.g. SHOW KEY/FULL KIT_CXX_VAX_VMS) |
| Moderator: | DECCXX::AMARTIN |
| Created: | Fri Nov 06 1987 |
| Last Modified: | Thu Jun 05 1997 |
| Last Successful Update: | Fri Jun 06 1997 |
| Number of topics: | 3604 |
| Total number of notes: | 18242 |
Following C++ code fragment demonstrates that C++ does not link
with Digital Unix V4.0B implementation of t_errno in xti.h
Why does C++ reference _terrno(void) ?
^^^^
Any ideas how to fix this?
Thanks,
Stuart.
X-posted in Digital Unix conference.
# cxx test_errno.C -o test_errno.o -c
# nm test_errno.o | grep errno
_terrno(void) | 0000000000000000 | U | 0000000000000008
# cxx test_errno.C -o test_errno -lxti
ld:
Unresolved:
_terrno(void)
# nm /usr/shlib/libxti.so | grep errno
_Get_terrno | 0004395912546600 | T | 0000000000000008
_Geterrno | 0000000000000000 | U | 0000000000000008
_Set_terrno | 0004395912546648 | T | 0000000000000008
_Seterrno | 0000000000000000 | U | 0000000000000008
__init_terrno | 0004395912546328 | T | 0000000000000008
_terrno | 0004395912546048 | T | 0000000000000008
errno | 0000000000000004 | C | 0000000000000000
free_terrno | 0004395912546536 | T | 0000000000000008
t_errno | 0004396978018736 | S | 0000000000000000
#include <xti.h>
#include <iostream.h>
class test_errno
{
public:
test()
{
int t;
t = t_errno;
cout << t;
}
};
main()
{
test_errno te;
te.test();
}
| T.R | Title | User | Personal Name | Date | Lines |
|---|---|---|---|---|---|
| 3594.1 | It looks like a bug in the header | DECC::J_WARD | Mon Jun 02 1997 09:26 | 12 | |
It looks like the problem is that the prototype for
terrno() in xti.h was not wrapped in extern "C" declaration.
A workaround would be to add it yourself, i.e.:
extern "C" {
#include <xti.h>
}
This should be reported as a QAR against the UNIX operating
operating system...previous notes have described how to do this.
| |||||
| 3594.2 | See Digital_UNIX 9973 | DECC::SULLIVAN | Jeff Sullivan | Mon Jun 02 1997 11:03 | 16 |
> This should be reported as a QAR against the UNIX operating > operating system...previous notes have described how to do this. I think this is correct. Other functions in /usr/include/xti.h are declared extern "C" (the _BEGIN_CPLUSPLUS/_END_CPLUSPLUS macros defined in standards.h accomplish this magic). It looks like _terrno() should be also. This was not a problem in V3.2, since _terrno was not included in /usr/include/xti.h. To verify, try this on both systems: % grep terrno /usr/include/xti.h I'll report an OSF_QAR, if it has not been done yet, and post the number in Digital_UNIX 9973. -Jeff | |||||
| 3594.3 | Thanks. | CHEFS::DAVIDSONS | Mon Jun 02 1997 15:56 | 1 | |