bug-commoncpp
[Top][All Lists]
Advanced

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

RE: sha.cpp compiler warnings


From: Chad Yates
Subject: RE: sha.cpp compiler warnings
Date: Fri, 13 Dec 2002 10:44:38 -0800

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]