F
Frederiek
Hi,
I'm using MS Visual C++ 2005 (MSVC8.0).
I am experiencing some kind of linker dilemma. While building a program
I am -in a way- forced to use following construct.
// aaa_ssf.h - some 3rd party open source library header file
class DBP_EXPORT AAA_SSF
{
public:
virtual ~AAA_SSF() { }
// other members
protected:
AAA_SSF() { }
// other members
};
DBP_EXPORT is a define that depends on whether the header file is used
to build a library, or in a program using the library. In case the
header is used to build a library, DBP_EXPORT is defined as
#define DBP_EXPORT __declspec (dllexport)
In case it is used to build a program based on the library, it is
defined as
#define DBP_EXPORT __declspec (dllimport)
I am using the header file to create a program based on the library. So
DBP_EXPORT is defined as __declspec (dllimport). But in case of the
above class, this causes a problem when building. The dllimport
specifier in front of the class name, seems to instruct the compiler to
put the class members that are called from the program, in the object
file as external defined functions. But they are not defined external,
they are defined inside the class definition itself.
When the linker processes the object file, it probably looks for some
library containing the class member definitions, but ofcourse it can't
find such a library, and it reports back a LNK2019 unresolved external
symbol error.
Is there a way to instruct the compiler that it should not indicate the
members as defined external if they are in fact defined in the source
itself, even if the dllimport specifier is used?
If this is not possible, I will have to start messing with the 3rd
party open source code, an activity which I'd like to postpone as long
as possible.
Regards,
Frederiek
I'm using MS Visual C++ 2005 (MSVC8.0).
I am experiencing some kind of linker dilemma. While building a program
I am -in a way- forced to use following construct.
// aaa_ssf.h - some 3rd party open source library header file
class DBP_EXPORT AAA_SSF
{
public:
virtual ~AAA_SSF() { }
// other members
protected:
AAA_SSF() { }
// other members
};
DBP_EXPORT is a define that depends on whether the header file is used
to build a library, or in a program using the library. In case the
header is used to build a library, DBP_EXPORT is defined as
#define DBP_EXPORT __declspec (dllexport)
In case it is used to build a program based on the library, it is
defined as
#define DBP_EXPORT __declspec (dllimport)
I am using the header file to create a program based on the library. So
DBP_EXPORT is defined as __declspec (dllimport). But in case of the
above class, this causes a problem when building. The dllimport
specifier in front of the class name, seems to instruct the compiler to
put the class members that are called from the program, in the object
file as external defined functions. But they are not defined external,
they are defined inside the class definition itself.
When the linker processes the object file, it probably looks for some
library containing the class member definitions, but ofcourse it can't
find such a library, and it reports back a LNK2019 unresolved external
symbol error.
Is there a way to instruct the compiler that it should not indicate the
members as defined external if they are in fact defined in the source
itself, even if the dllimport specifier is used?
If this is not possible, I will have to start messing with the 3rd
party open source code, an activity which I'd like to postpone as long
as possible.
Regards,
Frederiek