Home > Software engineering >  How in the DLL export CList, template class
How in the DLL export CList, template class

Time:10-31

Everybody is good, I met a in exported DLL issues which may be embarrassing, is I defined a derived class, but this class and use CList defines a variable, but CList is MFC class templates, no export, compile time appear warning C4251, how to settle this,

Pseudo code:

The class _declspec (dllimport) Ctemp
{
.
.
Public:
CList M_Qeque;
.
.
}

CList in afxtempl. H definition:

Template
The class CList: public CObject
{
.
.
.
}

CodePudding user response:

That need not CList, or use the MFC derived classes

CodePudding user response:

This is the code before others, has been used in other places, is now a requirement to make DLL, change of momentum is too big

CodePudding user response:

This definition is wrong,
Assuming CList in your compiler versions do not match the compiled version of the user, so will lead to errors,

If your data is not public, but is private so you can use the same memory layout instead.

CodePudding user response:

The
reference 3 floor Saleayas response:
definition is wrong, so
Assuming CList in your compiler versions do not match the compiled version of the user, so will lead to errors,

If your data is not public, but is private so you can use the same memory layout instead of


Yes, thanks to correct me, although I wrote the program is private, but I don't know the public what the consequences would be, so just wrote, or are you more careful,

CodePudding user response:

DLL export suggest use C or COM interface or you will have a version problem,
  • Related