From: Grzegorz J. <ja...@he...> - 2002-11-25 09:04:18
|
On Fri, 22 Nov 2002, suresh wrote: [...] > 1. When I am trying to load the metaclass for c functions. It is > giving warning that: 'Mop is not able to load the "CFunctionClass" '. Which version of OpenC++ is it? What OS is this? Are you compiling your metaclass to dlopenable module (usually something like CFunctionClass.so)? Are you sure the library function (dlopen() or lt_dlopen(), depending on the version of OpenC++) is able to find your dlopenable module (depending on OS you may be required to set up LD_LIBRARY_PATH or something similar)? [...] > 2. I have several classes. I am using the same metaclass for all > classes' code translation. The problem is I need to see how many objects > of a class (say classA) are instantiated in the whole application. I.e. > there may be a class classB where the object of classA is instantiated. > I want to know all such objects and put the MACRO definition for them in > the class header file. I do not quite understand. Object instantiation takes place during the execution. OpenC++ deals with classes defined in the input file, not objects that are instantiated during the execution of (possibly compiled) input file. Perhaps you are trying to find all classes in which instantiation of objects of 'classA' can possibly take place. In general this is difficult, but possible. Observe, that object of type 'classA' can be instantiated in many ways, for instance: * definition of variable of type 'classA', * instantiation of object that has (possibly indirect) subobject of type 'classA' or member of type 'classA' * 'new classA' * 'classA()' within expression * user-defined conversion (this one is difficult to find!!!) Think also about distasters like: template <class T> class Foo { ... }; template <class T> class Foo<T*> { ... new classA ... }; There is a possible instantiation of object of type 'classA' within some (!) specializations of class template Foo. Hopefully you do not need to handle all the above cases. It is also not clear to me where you want to put your macro, why you want to do it and what would it expand to --- declaration, expression? > 3. As I have one metaclass, I want to statically overload this > metaclass so that I don't need to insert the metaclass declaration > before every class definition. I do not quite understand what you mean by "overloading a metaclass". In C++ you can overload functions, not classes (nor metaclasses in OpenC++). > I tried using > "ChangeDefaultMetaClass("mainMetaClass)" by calling it from the > Initialize() method and using -S option at the time of compilation but > this is not working. > > %occ -S mainMetaClass.mc > > this command is giving me problems at the time of linking. Error message would help a lot to see what is really going wrong. If you can post short exemplary source on which occ fails, that would help even more. Best regards Grzegorz ################################################################## # Grzegorz Jakacki Huada Electronic Design # # Senior Engineer, CAD Dept. 1 Gaojiayuan, Chaoyang # # tel. +86-10-64365577 x2074 Beijing 100015, China # # Copyright (C) 2002 Grzegorz Jakacki, HED. All Rights Reserved. # ################################################################## |