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: Eduardo Villanueva Che
Subject: Re: [gnutls-dev] Building GnuTLS 1.6.1 under Mac OS X (fwd)
Date: Tue, 13 Feb 2007 03:23:09 +0100

> From: Rupert Kittinger-Sereinig <rks <at> mur.at>
> Subject: Re: Building GnuTLS 1.6.1 under Mac OS X (fwd)
> Newsgroups: gmane.comp.encryption.gpg.gnutls.devel
> Date: 2007-02-01 17:55:51 GMT (1 week, 4 days, 3 hours and 17 minutes
> ago)
> 
> >> 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 
> >> :-)
> > 
> > I'd really appreciate your help here.  What would your recommendation
> > be, more specifically?  The old code is the one which is used when the
> > newly added #if's are not chosen.  I've seen other bug reports too,
> > such as this failure:
> > 
> >>> verify-elf: ERROR: ./usr/lib/libgnutlsxx.so.13.2.2: undefined symbol: 
> >>> _ZN6gnutls11credentials7set_ptrEPv
> > 
> > But that may actually be the same, I don't know...
> > 
> > /Simon
> 
> Hi Simon,

Hi all, 

I have the same problem with Linux, but the bug is platform independent, it's a 
C++ issue.

> to make sense of the above error message, you need to feed it through 
> c++filt, so we get
> 
> /usr/lib/libgnutlsxx.so.13.2.2: undefined symbol: 
> gnutls::credentials::set_ptr(void*)
> 
> So, gnutls::credentials::set_ptr(void*) is missing from the library.
>
> The reason is almost certainly that the functions was declared inline. 

No, it's missing because it was declared as pure virtual. Apparently
there are no problem with this, because it was defined in each derived
class. That's OK, but it has one limitation:

A virtual function MUST NOT be called inside constructors or destructors,
because such calls will never go to a more derived class than the caller class.
At this point, the derived class wasn't constructed yet (in the constructor),
or it was destroyed (in the destructor).

When a virtual function is called inside the constructor/destructor,
the compiler ALWAYS uses the base class implementation, but here the
base class function was declared as pure virtual, so it was undefined.

But this isn't the only problem, at the moment the C++ API is very dangerous,
the copy operators/constructors must be explicitly coded or disabled.
The exception class must be specialized too.

This patches (see attached files), fixes the virtual function bug at 
credentials.
I added a noncopyable base class, and all classes with dangerous copy
operator/constructor derive now from it. This is a quick fix, until they
will be coded correctly.

I ported the "ex-client2.c" to C++, using the C++ API, and I will try to
port all the examples tomorrow, and I'll test the API more.

I'm interested in the C++ API, and I offer my help to improve it.


Eduardo Villanueva Che.

Attachment: exx-client2.cpp
Description: Text Data

Attachment: gnutlsxx.cpp.patch
Description: Text Data

Attachment: gnutlsxx.h.patch
Description: Text Data


reply via email to

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