[botan-devel] Build in VisualStudio Fails along with warnings "non dll interface class" and see declaration of 'Botan::Pipe::Invalid_Message_Number'

john skaller skaller at users.sourceforge.net
Tue Nov 19 00:54:23 EST 2013


On 19/11/2013, at 4:30 PM, Sitaraman Vilayannur wrote:

> Hi,
>  When I build botan with the example files in doc I get the following kind of warnings and error message and build fails....any pointers on what I am missing is much appreciated.
> Sitaraman

I'm not a windows programmer but this text may be relevant:

http://msdn.microsoft.com/en-us/library/y4h7bcy6%28v=vs.110%29.aspx

The DLL interface refers to all items (functions and data) that are known to be exported by some program in the system; that is, all items that are declared as dllimport or dllexport.

Inheritance and Exportable Classes
All base classes of an exportable class must be exportable. If not, a compiler warning is generated. Moreover, all accessible members that are also classes must be exportable. This rule permits a dllexport class to inherit from a dllimport class, and a dllimport class to inherit from a dllexport class (though the latter is not recommended). As a rule, everything that is accessible to the DLL's client (according to C++ access rules) should be part of the exportable interface. This includes private data members referenced in inline functions.

Roughly this seems to be saying you're building in such a way that std::runtime_error is not
an exported class.

This is hard to believe unless you're trying to build static, this is absolutely not an option
on Windows. Never build static anything. I say hard to believe because I would guess
all the standard C++ exception stuff is in a DLL and is declared dllexport/dllimport,
just like all the rest of (non polymorphic) C++ standard library has to be.

The only way I can think to break this is if you try to build a dll, so you have a dll-export class,
but you're linking to the C++ library statically, so the base class is not dllimport (or dllexport),
thus breaking the rule above and triggering the warning.

Otherwise it would have to be a bug in MS libraries.

> c:\program files (x86)\botan\include\botan\bigint.h(44): warning C4275: non dll-interface class 'std::runtime_error' used as base for dll-interface struct 'Botan::BigInt::DivideByZero'
> 
> 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdexcept(158) : see declaration of 'std::runtime_error'
> 
> 1> c:\program files (x86)\botan\include\botan\bigint.h(43) : see declaration of 'Botan::BigInt::DivideByZero'
> 
> 1>c:\program files (x86)\botan\include\botan\pipe.h(38): warning C4275: non dll-interface class 'std::invalid_argument' used as base for dll-interface struct 'Botan::Pipe::Invalid_Message_Number'
> 
> 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdexcept(74) : see declaration of 'std::invalid_argument'
> 
> 1> c:\program files (x86)\botan\include\botan\pipe.h(37) : see declaration of 'Botan::Pipe::Invalid_Message_Number'
> 
> 1> Generating Code...
> 
> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
> 
>  
> _______________________________________________
> botan-devel mailing list
> botan-devel at randombit.net
> http://lists.randombit.net/mailman/listinfo/botan-devel

--
john skaller
skaller at users.sourceforge.net
http://felix-lang.org





More information about the botan-devel mailing list