R
Robert A Riedel
I have a class that is intended to be exported in a DLL that uses another
class that is in a static library. All clients that use the DLL will also
link with the same static library. In summary, the following condition
exists:
class A {} ; // Instantiated in the static library and specified
// in a header included by all clients.
//
// This is the class using A that is exported by a DLL.
//
class __declspec( dllexport ) B
{
public :
B( const A & ) ;
const A &
value( void ) const ;
private :
A _a ;
} ;
Of course, the implementation of class B is not shown, and class A
has other members, so the entire example is greatly simplified, however,
compilation of code similar to this always results in a C4251 warning
being issued on any line where a type of class A is referenced by a class
using the dllexport attribute.
The question to be posed is how does one eliminate the C4251 warning without
re-declaring class A using the dllexport directive. The intent is not to
export
this class in any DLL since it is to be resolved at link-time, not
run-time -- that
is: all clients using class A must use the appropriate header and link with
the
static library.
NOTE: This message was posted to both the dotnet.languages.vc and
vc.language newsgroups.
--
======================================================================
======================================================================
==
== Bob Riedel
== Beckman Coulter, Incorporated
== PO Box 8000 W-529
== 200 S Kraemer Blvd
== Brea CA 92822-8000
==
== Email 1: (e-mail address removed)
== Email 2: (e-mail address removed)
==
==
== The opinions expressed are my own, and do not necessarily represent
== those of Beckman Coulter, Inc.
==
======================================================================
======================================================================
==
== "Effective education is the key to successful democracy."
==
== "Criticizing the actions of others offers so little risk, and
== requires so little effort that it is, without exception, the tool
== of the lazy and of the foolish -- who have neither the intelligence
== to discover, nor the discipline to pursue, a realistic
== alternative."
==
======================================================================
======================================================================
class that is in a static library. All clients that use the DLL will also
link with the same static library. In summary, the following condition
exists:
class A {} ; // Instantiated in the static library and specified
// in a header included by all clients.
//
// This is the class using A that is exported by a DLL.
//
class __declspec( dllexport ) B
{
public :
B( const A & ) ;
const A &
value( void ) const ;
private :
A _a ;
} ;
Of course, the implementation of class B is not shown, and class A
has other members, so the entire example is greatly simplified, however,
compilation of code similar to this always results in a C4251 warning
being issued on any line where a type of class A is referenced by a class
using the dllexport attribute.
The question to be posed is how does one eliminate the C4251 warning without
re-declaring class A using the dllexport directive. The intent is not to
export
this class in any DLL since it is to be resolved at link-time, not
run-time -- that
is: all clients using class A must use the appropriate header and link with
the
static library.
NOTE: This message was posted to both the dotnet.languages.vc and
vc.language newsgroups.
--
======================================================================
======================================================================
==
== Bob Riedel
== Beckman Coulter, Incorporated
== PO Box 8000 W-529
== 200 S Kraemer Blvd
== Brea CA 92822-8000
==
== Email 1: (e-mail address removed)
== Email 2: (e-mail address removed)
==
==
== The opinions expressed are my own, and do not necessarily represent
== those of Beckman Coulter, Inc.
==
======================================================================
======================================================================
==
== "Effective education is the key to successful democracy."
==
== "Criticizing the actions of others offers so little risk, and
== requires so little effort that it is, without exception, the tool
== of the lazy and of the foolish -- who have neither the intelligence
== to discover, nor the discipline to pursue, a realistic
== alternative."
==
======================================================================
======================================================================