|
Boost Users : |
From: Alan M. Carroll (amc_at_[hidden])
Date: 2008-07-30 17:51:42
You can ignore 4275 for pure header template classes. The only risk is if you have different definitions for the template or any of its parameters (which is bad for other reasons, which are likely to trip you up before 4275 manifests).
You could try this -
In the header:
template struct __declspec(dllexport) boost::error_info<struct tag_error, unsigned>; // at file scope
In a library source file:
template struct boost::error_info<struct tag_error, unsigned>; // at file scope
You may need to use "class" instead of "struct", depends on how error_info is defined. According to Microsoft documentation, this will result in the implementation of the fully specified template residing in the library. I have tried it and the code that depends on it works, but it's unclear if it's really instantiating the template in the library.
At 02:36 AM 7/28/2008, you wrote:
>I am not much of a Windows programmer, so I have a basic question. I want to make a library that (among other stuff) defines an exception like this:
>
>#include <boost/exception/exception.hpp>
>
>namespace speedo {
>
> typedef boost::error_info<struct tag_error, unsigned> error_info;
>
> class __declspec(dllexport) exception : public boost::exception
> {
> };
>
>}
>
>When I try to compile this, I get the following warning:
>
>c:\cygwin\home\andrej\speedo\trunk\util\exception.h(14) : warning C4275: non dll-interface class 'boost::exception' used as base for dll-interface class 'speedo::exception'
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net