bug-commoncpp
[Top][All Lists]
Advanced

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

Re: sha.cpp compiler warnings


From: Prochnow, Christian
Subject: Re: sha.cpp compiler warnings
Date: Sat, 14 Dec 2002 17:35:46 +0100
User-agent: KMail/1.4.3

Ok,

i missed to interpret a new warning that comes up :(
i also forget to mention two additional lines needed (after their class 
declaration):

#ifdef WIN32
template class CCXX_CLASS_EXPORT SHADigest<uint64, 64>;
template class CCXX_CLASS_EXPORT SHATumbler<uint32>;
#endif

but adding this leads to more weird Warnings :(
They're all related to the template implementation that actually resides in  
the .cpp file. 
Seems that M$ compilers (tried it with VC 6 and VC.NET) does'nt like this.
I think simpliest and portable solution would be to move the template-class 
implementations into the header file.

Regards, Christian



Am Freitag 13 Dezember 2002 19:44 schrieben Sie:
> Chris wrote:
> > you should add CCXX_CLASS_EXPORT in front of the template class
> > declaration:
> >
> > template <class uint_type, unsigned blockSizeInBytes>
> > class CCXX_CLASS_EXPORT SHADigest {
> >          ^^^^^^^^^^^^^^^^^^^^^^^^
> >
> > this works. tried it with VC 6 and VC.NET.
> > you don't need "extern template" declaration or something else.
> >
> > Regards,
> > Christian Prochnow
>
> chris,
>
> no offense, but did you "actually" try it on the sha digest class and the
> test program Elizabeth provided.  I've updated my source from cvs with the
> changes you mentioned, and still get the following when compiling/linking
> digest.cpp and the test program. Am I doing something wrong?
>
> Compiling...
> digest.cpp
> e:\projects\c\commoncpp2\include\cc++\digest.h(383) : warning C4275: non
> dll-interface class 'ost::SHADigest<unsigned __int64,64>' used as base for
> dll-interface class 'ost::SHA64DigestHelper'
> e:\projects\c\commoncpp2\include\cc++\digest.h(383) : see declaration of
> 'SHA64DigestHelper' e:\projects\c\commoncpp2\include\cc++\digest.h(385) :
> warning C4251: 'h' : class 'ost::SHATumbler<unsigned __int32>' needs to
> have dll-interface to be used by clients of class 'ost::SHA64DigestHelper'
> e:\projects\c\commoncpp2\include\cc++\digest.h(386) : warning C4251: 'a' :
> class 'ost::SHATumbler<unsigned __int32>' needs to have dll-interface to be
> used by clients of class 'ost::SHA64DigestHelper' Skipping... (no relevant
> changes detected)
> md5.cpp
> sha.cpp
> Linking...
> --------------------Configuration: digesttest - Win32
> Debug-------------------- Compiling...
> digesttest.cpp
> e:\projects\c\commoncpp2\include\cc++\digest.h(385) : warning C4251: 'h' :
> class 'ost::SHATumbler<unsigned __int32>' needs to have dll-interface to be
> used by clients of class 'ost::SHA64DigestHelper'
> e:\projects\c\commoncpp2\include\cc++\digest.h(386) : warning C4251: 'a' :
> class 'ost::SHATumbler<unsigned __int32>' needs to have dll-interface to be
> used by clients of class 'ost::SHA64DigestHelper' Linking...
> digesttest.obj : error LNK2001: unresolved external symbol "public: virtual
> void __thiscall ost::SHADigest<unsigned __int64,64>::putDigest(unsigned
> char const *,unsigned int)"
> (address@hidden@_K$0EA@@ost@@address@hidden) Debug/digesttest.exe :
> fatal error LNK1120: 1 unresolved externals Error executing link.exe.
>
> ???
>
> I was able to get rid of all warnings (and subsequent warnings) last night
> (using the link Elizabeth provided as a starting place), but to do so I had
> to move the template class implementations into the class declaration
> itself in the .h file, and add dummy implementations for any abstract
> methods so the msvc++ could instantiate them explicitly for export.  I
> noticed that there are no other commoncpp2 classes like this (that use
> templates in this manner), perhaps they have been avoided for the reasons
> we are finding out.  if someone wants to look at the code, I can send it to
> them, but it's pretty ugly as it was a cut and paste marathon.  If I didn't
> get the link error, I would just say bag it, but the warnings seem to
> really be more than warnings.  maybe I'm just naive, but if I am I'd like
> to understand the problem/solution so I can use templated classes in a dll
> in the future and have it be cross-platform compatible.
>
> Any thoughts?
>
> ,chad




reply via email to

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