erreur de DLL avec VC8 et Stingray
Desolez de l'anglais mais bon je ne veux pas reecrire toute ma question
---------------------------------------------
Alright, this is not code oriented and so I'll make it brieft:
Sorry don't know how to add code in this forum yet (rather new)
A class like this:
Code:
1 2 3 4 5 6 7 8 9
| #ifndef VXT_SIMPLE_BUTTON_SPEC
#ifdef VXT_UIUTILS_DLL
#define VXT_SIMPLE_BUTTON_SPEC __declspec(dllexport)
#else
#define VXT_SIMPLE_BUTTON_SPEC __declspec(dllimport)
#endif
#endif
class VXT_SIMPLE_BUTTON_SPEC vxtUISimpleButton: public CGXStatic |
the inherited class is FROM stingray and is now using dll interface compared to previous release like so:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| #ifdef _GXDLL
#ifdef _GXDLL_IMPL
#define GRID_API __declspec( dllexport )
// #pragma message("GRID_API: dllexport")
#else
#define GRID_API __declspec( dllimport )
// #pragma message("GRID_API: dllimport")
#endif
#else // !_GXDLL
#define GRID_API
#endif
class CGXStatic : public CGXControl
{
DECLARE_CONTROL(CGXStatic)
// Construction
public:
// Constructor & Destructor
GRID_API CGXStatic(CGXGridCore* pGrid);
GRID_API virtual CRect GetCellRect(ROWCOL nRow, ROWCOL nCol, LPRECT rectItem = NULL, const CGXStyle* pStyle = NULL);
// compute the interior rectangle for the text
// without buttons and borders
GRID_API virtual CSize AddBorders(CSize size, const CGXStyle& style); // counterpart to GetCellRect
GRID_API virtual CSize CalcSize(CDC* pDC, ROWCOL nRow, ROWCOL nCol, const CGXStyle& style, const CGXStyle* pStandardStyle, BOOL bVert);
GRID_API virtual BOOL CanFloatCell(ROWCOL nRow, ROWCOL nCol, const CGXStyle& style, BOOL bFloatOrFlood);
GRID_API virtual void Draw(CDC* pDC, CRect rect, ROWCOL nRow, ROWCOL nCol, const CGXStyle& style, const CGXStyle* pStandardStyle);
// cells tips enable
GRID_API void ImplementCellTips();
}; |
Now this returns:
error C2487: member of dll interface class may not be declared with dll interface
When using the macro:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| #define DECLARE_CONTROL(class_name) \
protected: \
GRID_API static CGXControlClass* PASCAL _GetControlBaseClass(); \
public: \
static GX_DATA CGXControlClass ctrl##class_name; \
GRID_API virtual CGXControlClass* GetControlClass() const; \
#define IMPLEMENT_CONTROL(class_name, base_class_name) \
CGXControlClass* PASCAL class_name::_GetControlBaseClass() \
{ return CONTROL_CLASS(base_class_name); } \
GX_DATADEF CGXControlClass class_name::ctrl##class_name = { \
#class_name, &class_name::_GetControlBaseClass }; \
CGXControlClass* class_name::GetControlClass() const \
{ return &class_name::ctrl##class_name; } \
DECLARE_CONTROL(vxtUISimpleButton) |
So I tried not using dllimport ON the class but instead on every functions
Which returned this:
warning C4273 : inconsistent dll linkage
on the macro:
Code:
1 2 3 4 5 6 7 8 9
| #define IMPLEMENT_CONTROL(class_name, base_class_name) \
CGXControlClass* PASCAL class_name::_GetControlBaseClass() \
{ return CONTROL_CLASS(base_class_name); } \
GX_DATADEF CGXControlClass class_name::ctrl##class_name = { \
#class_name, &class_name::_GetControlBaseClass }; \
CGXControlClass* class_name::GetControlClass() const \
{ return &class_name::ctrl##class_name; } \
IMPLEMENT_CONTROL(vxtUISimpleButton, CGXStatic) |
Which is present because (I think) that we defined this function:
Code:
virtual VXT_SIMPLE_BUTTON_SPEC vxtVoid Draw(CDC* pDC, CRect rect, ROWCOL nRow, ROWCOL nCol, const CGXStyle& style, const CGXStyle* pStandardStyle);
and the stingray class defined it this way:
Code:
GRID_API virtual void Draw(CDC* pDC, CRect rect, ROWCOL nRow, ROWCOL nCol, const CGXStyle& style, const CGXStyle* pStandardStyle);
Both are on dllImport
Any suggestion on how to "cleanly" remove the error and warning?