[Botan-devel] Generation of build.h [WAS: Warning C4275 Messages When Building Base64 Example]

Joel Low joel at joelsplace.sg
Thu Feb 19 05:12:34 EST 2009


Hello,

Charles just brought up that __declspec(dllexport) is defined regardless of whether --shared was passed to configure. It should more accurately be defined as __declspec(dllimport) if Botan was configured for shared, and defined to nothing in static builds. Then, for shared builds, the makefile should define BOTAN_DLL as __declspec(dllexport)

Charles: in the meantime you could open up build.h (in your Botan directory) and define BOTAN_DLL to nothing.

Regards,
Joel


> -----Original Message-----
> From: botan-devel-bounces at randombit.net [mailto:botan-devel-
> bounces at randombit.net] On Behalf Of Charles Brockman
> Sent: Thursday, 19 February, 2009 3:36 AM
> To: botan-devel at randombit.net
> Subject: [Botan-devel] Warning C4275 Messages When Building Base64
> Example
> 
> I created a project in Microsoft Visual Studio 2008 (Version 9) under
> Windows XP to compile the Botan-1.8.1\doc\examples\base64.cpp file
> using the
> static, not DLL, runtime library. I'm linking to a version of the Botan
> library configured for static runtime. The project compiles, links and
> runs
> but the compiler produces the following warnings.
> 
> 
> c:\botan-1.8.1\build\include\botan\exceptn.h(19) : warning C4275: non
> dll-interface class 'std::exception' used as base for dll-interface
> class
> 'Botan::Exception'
>         c:\program files\microsoft visual studio
> 9.0\vc\include\exception(95) : see declaration of 'std::exception'
>         c:\botan-1.8.1\build\include\botan\exceptn.h(18) : see
> declaration
> of 'Botan::Exception'
> c:\botan-1.8.1\build\include\botan\exceptn.h(27) : warning C4251:
> 'Botan::Exception::msg' : class 'std::basic_string<_Elem,_Traits,_Ax>'
> needs
> to have dll-interface to be used by clients of class 'Botan::Exception'
>         with
>         [
>             _Elem=char,
>             _Traits=std::char_traits<char>,
>             _Ax=std::allocator<char>
>         ]
> c:\botan-1.8.1\build\include\botan\symkey.h(41) : warning C4251:
> 'Botan::OctetString::bits' : class 'Botan::SecureVector<T>' needs to
> have
> dll-interface to be used by clients of class 'Botan::OctetString'
>         with
>         [
>             T=Botan::byte
>         ]
> c:\botan-1.8.1\build\include\botan\sym_algo.h(47) : warning C4290: C++
> exception specification ignored except to indicate a function is not
> __declspec(nothrow)
> c:\botan-1.8.1\build\include\botan\sym_algo.h(55) : warning C4290: C++
> exception specification ignored except to indicate a function is not
> __declspec(nothrow)
> c:\botan-1.8.1\build\include\botan\s2k.h(94) : warning C4251:
> 'Botan::S2K::salt' : class 'Botan::SecureVector<T>' needs to have
> dll-interface to be used by clients of class 'Botan::S2K'
>         with
>         [
>             T=Botan::byte
>         ]
> c:\botan-1.8.1\build\include\botan\data_src.h(113) : warning C4251:
> 'Botan::DataSource_Memory::source' : class 'Botan::SecureVector<T>'
> needs to
> have dll-interface to be used by clients of class
> 'Botan::DataSource_Memory'
>         with
>         [
>             T=Botan::byte
>         ]
> c:\botan-1.8.1\build\include\botan\data_src.h(139) : warning C4251:
> 'Botan::DataSource_Stream::identifier' : class
> 'std::basic_string<_Elem,_Traits,_Ax>' needs to have dll-interface to
> be
> used by clients of class 'Botan::DataSource_Stream'
>         with
>         [
>             _Elem=char,
>             _Traits=std::char_traits<char>,
>             _Ax=std::allocator<char>
>         ]
> c:\botan-1.8.1\build\include\botan\filter.h(80) : warning C4251:
> 'Botan::Filter::write_queue' : class 'Botan::SecureVector<T>' needs to
> have
> dll-interface to be used by clients of class 'Botan::Filter'
>         with
>         [
>             T=Botan::byte
>         ]
> c:\botan-1.8.1\build\include\botan\filter.h(81) : warning C4251:
> 'Botan::Filter::next' : class 'std::vector<_Ty>' needs to have dll-
> interface
> to be used by clients of class 'Botan::Filter'
>         with
>         [
>             _Ty=Botan::Filter *
>         ]
> c:\botan-1.8.1\build\include\botan\data_snk.h(55) : warning C4251:
> 'Botan::DataSink_Stream::identifier' : class
> 'std::basic_string<_Elem,_Traits,_Ax>' needs to have dll-interface to
> be
> used by clients of class 'Botan::DataSink_Stream'
>         with
>         [
>             _Elem=char,
>             _Traits=std::char_traits<char>,
>             _Ax=std::allocator<char>
>         ]
> c:\botan-1.8.1\build\include\botan\base64.h(48) : warning C4251:
> 'Botan::Base64_Encoder::in' : class 'Botan::SecureVector<T>' needs to
> have
> dll-interface to be used by clients of class 'Botan::Base64_Encoder'
>         with
>         [
>             T=Botan::byte
>         ]
> c:\botan-1.8.1\build\include\botan\base64.h(48) : warning C4251:
> 'Botan::Base64_Encoder::out' : class 'Botan::SecureVector<T>' needs to
> have
> dll-interface to be used by clients of class 'Botan::Base64_Encoder'
>         with
>         [
>             T=Botan::byte
>         ]
> c:\botan-1.8.1\build\include\botan\base64.h(86) : warning C4251:
> 'Botan::Base64_Decoder::in' : class 'Botan::SecureVector<T>' needs to
> have
> dll-interface to be used by clients of class 'Botan::Base64_Decoder'
>         with
>         [
>             T=Botan::byte
>         ]
> c:\botan-1.8.1\build\include\botan\base64.h(86) : warning C4251:
> 'Botan::Base64_Decoder::out' : class 'Botan::SecureVector<T>' needs to
> have
> dll-interface to be used by clients of class 'Botan::Base64_Decoder'
>         with
>         [
>             T=Botan::byte
>         ]
> c:\botan-1.8.1\build\include\botan\hex.h(54) : warning C4251:
> 'Botan::Hex_Encoder::in' : class 'Botan::SecureVector<T>' needs to have
> dll-interface to be used by clients of class 'Botan::Hex_Encoder'
>         with
>         [
>             T=Botan::byte
>         ]
> c:\botan-1.8.1\build\include\botan\hex.h(54) : warning C4251:
> 'Botan::Hex_Encoder::out' : class 'Botan::SecureVector<T>' needs to
> have
> dll-interface to be used by clients of class 'Botan::Hex_Encoder'
>         with
>         [
>             T=Botan::byte
>         ]
> c:\botan-1.8.1\build\include\botan\hex.h(82) : warning C4251:
> 'Botan::Hex_Decoder::in' : class 'Botan::SecureVector<T>' needs to have
> dll-interface to be used by clients of class 'Botan::Hex_Decoder'
>         with
>         [
>             T=Botan::byte
>         ]
> c:\botan-1.8.1\build\include\botan\hex.h(82) : warning C4251:
> 'Botan::Hex_Decoder::out' : class 'Botan::SecureVector<T>' needs to
> have
> dll-interface to be used by clients of class 'Botan::Hex_Decoder'
>         with
>         [
>             T=Botan::byte
>         ]
> c:\botan-1.8.1\build\include\botan\filters.h(77) : warning C4251:
> 'Botan::StreamCipher_Filter::buffer' : class 'Botan::SecureVector<T>'
> needs
> to have dll-interface to be used by clients of class
> 'Botan::StreamCipher_Filter'
>         with
>         [
>             T=Botan::byte
>         ]
> c:\botan-1.8.1\build\include\botan\algo_factory.h(120) : warning C4251:
> 'Botan::Algorithm_Factory::engines' : class 'std::vector<_Ty>' needs to
> have
> dll-interface to be used by clients of class 'Botan::Algorithm_Factory'
>         with
>         [
>             _Ty=Botan::Engine *
>         ]
> c:\botan-1.8.1\build\include\botan\libstate.h(103) : warning C4251:
> 'Botan::Library_State::config' : class 'std::map<_Kty,_Ty>' needs to
> have
> dll-interface to be used by clients of class 'Botan::Library_State'
>         with
>         [
>             _Kty=std::string,
>             _Ty=std::string
>         ]
> c:\botan-1.8.1\build\include\botan\libstate.h(107) : warning C4251:
> 'Botan::Library_State::alloc_factory' : class 'std::map<_Kty,_Ty>'
> needs to
> have dll-interface to be used by clients of class
> 'Botan::Library_State'
>         with
>         [
>             _Kty=std::string,
>             _Ty=Botan::Allocator *
>         ]
> c:\botan-1.8.1\build\include\botan\libstate.h(109) : warning C4251:
> 'Botan::Library_State::allocators' : class 'std::vector<_Ty>' needs to
> have
> dll-interface to be used by clients of class 'Botan::Library_State'
>         with
>         [
>             _Ty=Botan::Allocator *
>         ]
> 
> 
> Can these warnings be eliminated? Should they be ignored?
> 
> --
> Charles Brockman
> 
> _______________________________________________
> botan-devel mailing list
> botan-devel at randombit.net
> http://lists.randombit.net/mailman/listinfo/botan-devel



More information about the botan-devel mailing list