CINT and MFC problem :(

devinim.solen@tde.alstom.com
Mon, 1 Feb 1999 13:37:37 +0200


I am using some MFC classes with cint as following lines; and I don't wanna use MFC class as defined
member (For example as pointer).

#if !defined(__CINT__)
class CChMenu : public CMenu
#else
class CChMenu
#endif // !defined(__CINT__)
{
public:
CChMenu();
~CChMenu();
};

... and to generate pre-compiled library script is;

cint -w1 -zChWinLib -nG__cpp_ChWinLib.cxx -D__MAKECINT__ -c-1 -A ChMenu.h

then when I compile it, get the error as;

D:\Projects\ChWinLib\G__cpp_ChWinLib.cxx(580) : error C2558: class 'CChMenu' : no copy constructor
available.

for following cint generated line;

static int G__CChMenu_CChMenu_1_0(G__value *result7,char *funcname,struct G__param *libp,int hash) {
CChMenu *p=NULL;
p = new((void*)G__getgvp()) CChMenu(*(CChMenu*)libp->para[0].ref); --------> Error occurred
line !!!!
result7->obj.i = (long)p;
result7->ref = (long)p;
result7->type = 'u';
result7->tagnum = G__get_linked_tagnum(&G__LN_CChMenu);
return(1 || funcname || hash || result7 || libp) ;
}

It need to be defined constructor CChMenu(CChMenu& menu), I dunno "Why ?". If I change my class
defination as follows;

#if !defined(__CINT__)
class CChMenu : public CMenu
#else
class CChMenu
#endif // !defined(__CINT__)
{
public:
CChMenu();
CChMenu(CChMenu& menu);
~CChMenu();
};

compiler error solves but then the poblem occurs in cint;

static int G__CChMenu_CChMenu_0_0(G__value *result7,char *funcname,struct G__param *libp,int hash) {
CChMenu *p=NULL;
if(G__getaryconstruct())
if(G__PVOID==G__getgvp())
p=new CChMenu[G__getaryconstruct()];
else {
for(int i=0;i<G__getaryconstruct();i++)
p=new((void*)(G__getgvp()+sizeof(CChMenu)*i)) CChMenu;
p=(CChMenu*)G__getgvp();
}
else p=new((void*)G__getgvp()) CChMenu; ------------------>>>>>>>>>>>>>>>>>>>>>>>> Because
G__getgvp() returns -1 always.
result7->obj.i = (long)p;
result7->ref = (long)p;
result7->type = 'u';
result7->tagnum = G__get_linked_tagnum(&G__LN_CChMenu);
return(1 || funcname || hash || result7 || libp) ;
}

So I need to help :) at this point.
The thrick I have been found to use as p=new CChMenu instead instead of p=new((void*)G__getgvp())
CChMenu; but I am not sure to use it like correct way. But it works.
What G__getgvp to do, I dunno exacly.

Best regards

Devinim SOLEN