Devinim, I'm happy to answer your question. >I am using some MFC classes with cint as following lines; and I don't wanna u se >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. This is very trickly. I think this is because CMenu has private copy constructor. Because of #if , CINT does not recognize that CMenu has private copy constructor and generates stub function for CChMenu class. The compiler assumes CChMenu(CChMenu& x) : CMenu(x) { /*memberwise copy*/ } which causes the problem. >#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; This case, compiler assumes CChMenu(CChMenu& x) : CMenu() { /*whatever defined in CChMenu ctor*/ } which is fine. >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. Getting -1 from G__getgvp() is fine. It should work that way. Overloaded new operator will deal with the special value -1 and allocates memory for the class. I do not know why this causes problem. There must be static void* operator new(size_t size,void *p) at the top of the dictionary source file. As long as this exists, it should be fine. Changing the line as p=new CChMenu; works as long as you do not instantiate CChMenu object as a class member or a base class of an interpreted class. class A { // interpreted class CChMenu x; // This causes problem if you do p=new CChMenu }; In this case, the member x must be part of A object whose memory is allocated for A. When CINT calls CChMenu constructor, it gives already allocated memory area by G__getgvp() access function. If you use 'new CChMenu', new memory area will be allocated which is bad. This kind of error happens with some library. Will you try -M0x10 option for cint. Meaning -M option mask bit is described in doc/message.txt. makecint -cint -M0x10 -mk Makefile -dl CChMenu.dll -H CChMenu.h or cint -w1 -zChWinLib -nG__cpp_ChWinLib.cxx -D__MAKECINT__ -c-1 -A -M0x10 ChMenu.h Thank you Masaharu Goto
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:28 MET