Re: Problem with a DLL and a Static Library
- From: Mihai Popescu <m_pop_escu@xxxxxxxxx>
- Date: Mon, 12 Jun 2006 18:14:49 +0300
Carl Daniel [VC++ MVP] wrote:
Mihai Popescu wrote:In my DLL project, in the header file, I have this macro:
#ifdef AGE_EXPORTS
#define AGE_API __declspec(dllexport)
#else
#define AGE_API __declspec(dllimport)
#endif
In the header file of the LIB, I put the previous preprocessor
directives. I've inlcuded the same(phisical) header file in the DLL
project and in the GUI, as in the LIB.
What's the value of AGE_EXPORTS when building the LIB? It looks like it's not defined but it should be.
-cd
-cd
Well, I guess it's not defined when building the LIB so AGE_API would become __declspec(dllimport). That's why I get that
"warning C4273: inconsistent dll linkage ".
I've also tried also to define AGE_API as an empty macro during LIB linkage, puting the following directives into LIB-s header files.
#ifdef DLL
#ifdef AGE_EXPORTS
#define AGE_API __declspec(dllexport)
#else
#define AGE_API __declspec(dllimport)
#endif
#else
#define AGE_API
#endif
Then I define DLL macro in the DLL project and in the GUI (#define DLL) before including header files (from the LIB directory).
But now, I get linker errors and new warnings:
"LNK2019: unresolved external symbol"
"warning C4005: 'AGE_API' : macro redefinition"
I guess I'll have to ignore previous warnings...even if I wonder why this second method doesnt work.
Of course there is a logical reason...but I don't get-it... That's why I'm asking for help... :D
Best regards! Mihai
.
- Follow-Ups:
- Re: Problem with a DLL and a Static Library
- From: Doug Harrison [MVP]
- Re: Problem with a DLL and a Static Library
- References:
- Problem with a DLL and a Static Library
- From: Mihai Popescu
- Re: Problem with a DLL and a Static Library
- From: Carl Daniel [VC++ MVP]
- Re: Problem with a DLL and a Static Library
- From: Mihai Popescu
- Re: Problem with a DLL and a Static Library
- From: Carl Daniel [VC++ MVP]
- Problem with a DLL and a Static Library
- Prev by Date: Re: PostThreadMessage to a thread that has a modal dialog shown
- Next by Date: Re: Problem with a DLL and a Static Library
- Previous by thread: Re: Problem with a DLL and a Static Library
- Next by thread: Re: Problem with a DLL and a Static Library
- Index(es):
Relevant Pages
|
Loading