Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: Dan.Pop@mail.cern.ch (Dan Pop)
Subject: Re: CXX header file problem
Date: 1995/10/13	[thread overview]
Message-ID: <danpop.813622496@rscernix> (raw)
In-Reply-To: 307D9F26.41C6@llnl.gov

In <307D9F26.41C6@llnl.gov> Mark Spruiell <mes@llnl.gov> writes:

>I'm attempting to port some software to DEC OSF/1 v3.2 using
>C++ V5.0-3.  One of my source files includes <sys/systeminfo.h>,
>which for some reason does not contain the C++'isms that most
>of the other header files contain.  Hence, the compiler uses
>C++ linkage for the sysinfo() function and the loader winds up
>with an unresolved external.

That's strange, because on my system (3.2a) the declaration of
sysinfo is protected by ``#if defined(__STDC__) && !defined(_KERNEL)''
so the C++ compiler doesn't "see" it at all:

    ues5:~/tmp 312> cat test.cc
    #include <sys/systeminfo.h>

    void foo()
    {
    sysinfo(0, (char *)0, 0L);
    }
    ues5:~/tmp 313> cxx test.cc
    test.cc:5: error: In this statement, "sysinfo" is not declared.
    Compilation terminated with errors. 

>
>The workaround is obvious:
>
>extern "C" {
>#include <sys/systeminfo.h>
>}

It won't work on my system.

>But I was hoping this might have been an oversight on DEC's
>part, and that a patch is available???
>
>Any ideas?

Yes.  Patch /usr/include/sys/systeminfo.h yourself.
If portability is a concern, you're out of luck, until DEC will decide
to fix it.

Your best chance to be portable is to provide the prototype yourself
and hope that DEC won't change it when it will become visible to the
C++ compiler.

Dan
--
Dan Pop
CERN, CN Division
Email: Dan.Pop@mail.cern.ch 
Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland



      reply	other threads:[~1995-10-13  4:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-10-12  4:00 CXX header file problem Mark Spruiell
1995-10-13  4:00 ` Dan Pop [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox