Re: CINT and compiled code

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Feb 28 2000 - 09:16:35 MET


Anton,
You can read the following extract from the CINT FAQ at:
    http://root.cern.ch/root/Cint.phtml?faq
I understand from Masa that inheriting from a compiled class
could be implemented in the medium long term. This is highly
machine/compiler
dependent.
Note that this limitation can be removed if you use the script compiler.
I posted an example last week.

Rene Brun


############################################################################
# Can I inherit precompiled class from an interpreted class?
# Virtual function sometimes does not work properly.

 Cint supports class inheritance and virtual function calls in almost
full
 C++ spec both within interpreted classes and precompiled classes.   But 
 there is fundamental difficulty in mixing interpreted/precompiled
virtual 
 functions.

 You could inherit precompiled class from an interpreted class, however, 
 virtual function calls do not work properly. Every C++ compiler has
 proprietary Virtual Function Table format which is heavily
implementation
 dependent.  It is impossible for cint to match VTBL format of every C++
 compiler. Cint has its'own virtual function resolution mechanism. So, 
 virtual function or virtual base class can only be resolved within 
 interpreted classes or precompiled classes. 

 There exist other C++ interpreter which allows virtual function
resolution
 accross the interpreted/precompiled class boundary. But they severly 
 sacrifice portability among different OS and compiler. Cint does not do 
 this because portability is the primary importance to its concept.

 There is another case that virtual function of a precompiled class
 does not work properly. If you call virtual function of a precompiled
 class with scope operator, polymorphic resolution should be disabled
 and given specific function should be called. However in cint, you
 can not disable polymorphic resolution of a precompiled virtual
function.
 This leads to calling wrong function if base and derived classes are
 both precompiled.

Anton Fokin wrote:
> 
> Hi,
> 
> Another stupid question. CINT macro classes can not be inherited from
> compiled classes. That's pity but true because of the different virt tables.
> (By the way, is there any thoughts that this will every be possible?) Is
> there a way to substitute (overload) a function from compiled code in CINT
> macro? Or the only way to work with a user defined function is via
> SetFCN(void (*fcn)) as it is done in TMinuit?
> 
> Best,
> Anton



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:20 MET