[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::c_plus_plus

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

3594.0. "xti _terrno unresolved, Unix V4.0B?" by CHEFS::DAVIDSONS () Sat May 31 1997 21:07

    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.RTitleUserPersonal
Name
DateLines
3594.1It looks like a bug in the headerDECC::J_WARDMon Jun 02 1997 13:2612
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.2See Digital_UNIX 9973DECC::SULLIVANJeff SullivanMon Jun 02 1997 15:0316
> 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.3Thanks.CHEFS::DAVIDSONSMon Jun 02 1997 19:561