gnutls-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gnutls-dev] Building GnuTLS 1.6.1 under Mac OS X (fwd)


From: Rupert Kittinger-Sereinig
Subject: Re: [gnutls-dev] Building GnuTLS 1.6.1 under Mac OS X (fwd)
Date: Fri, 26 Jan 2007 22:08:29 +0100
User-agent: Thunderbird 1.5.0.5 (X11/20060719)

Simon Josefsson schrieb:
Matthias Scheler <address@hidden> writes:

        Hello,

the C++ library included in "gnutls" 1.6.1 doesn't build under Mac OS X
because of a compiler bug. Apple's GCC apparently doesn't handle calling
pure virtual function in constructors and desctrutors properly, see here:

http://porting.openoffice.org/mac/macosx_issues.html

I've attached two patches taken from NetBSD's "pkgsrc" which inline
the copy constructor of the "credentials" class under Mac OS X. That
fixes the build problem for me under Mac OS 10.4.8 using the G++
compiler from Xcode tools 2.4.1.

Hi!  While I really dislike adding #if's to work around compiler bugs
(people should fix their compilers), I'm not familiar enough with C++
or the GnuTLS C++ library to offer any better solution.  I have
installed the patch, with a comment about removing it in a few years.

Thanks,
Simon

Hi Simon,

I think that the "compiler bug" is described in the link is actually correct behaviour.

the relevant snippet:

MyAbstractClass MyWrapperClass::getClass()
    {
        static MyConcreteClass rClass;
        return rClass;
    }

Note that the return type is MyAbstractClass, but the function tries to return MyConcreteClass. So the return value is implicitely converted to its base class, it is "sliced". (The function being called in a constructor has nothing to do with it.) For virtual functions to work, the object must to acessed via pointer or reference.

I looked up the mail that reported the error, and it seems that the compiler fails to create an instance of the set_ptr() member function in the object file. In this case, I would try to uninline set_ptr(). This can hardly be a performance problem and should fix the linker error :-)

cheers,
Rupert

--
Rupert Kittinger-Sereinig <address@hidden>
Krenngasse 32
A-8010 Graz
Austria




reply via email to

[Prev in Thread] Current Thread [Next in Thread]