another cint bug ?

From: Jacek M. Holeczek (Jacek.Holeczek@Physik.uni-muenchen.de)
Date: Thu Oct 02 1997 - 11:07:14 MEST


Hi,
Please see the output ( linux 2.0.30 + root 1.03/04 ) :
-----------------------------------------------
holeczek@bizet> root
  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   1.03/04    1 October 1997   *
( ... )
root [0] gSystem.Load("~gardaq/Goosy/LMD.so")
(int)0
root [1] s=new TGoosyLMD               

  *******************************************
  *                                         *
  *          W  E  L  C  O  M  E            *
( ... )
root [2] .L DemoFCN.C
root [3] .L JH_DemoFCN.C
root [4] 
root [4] 
root [4] 
root [4] s.SetFCN(MIKIMOUSE)                 <--- uses SetFCN(void*)
*** Interpreter error recovered ***
root [5] 
root [5] 
root [5] 
root [5] 
root [5] .q
Warning: Re-initialization ignored const kTRUE
FILE:/usr/cern/Linux/root/include/Rtypes.h LINE:83
Warning: Re-initialization ignored const kFALSE
FILE:/usr/cern/Linux/root/include/Rtypes.h LINE:84
Error: No symbol MIKIMOUSE in current scope  FILE:/tmp/23291caa LINE:1
holeczek@bizet> 
-----------------------------------------------
Note here that the "Warnings" AND "Error" messages came out AFTER I left
root/cint. This is slighly painfull. I would rather have them "in place".
Expecially the "Error" explanations !!!
Moreover - my shared library ( LMD.so ) contains :
-----------------------------------------------
// This method sets the analysis function using function's name string.
// Used by both compiled and interpreted code.
// The analysis function must be "known" to cint interpreter.

Bool_t TGoosyLMD::SetFCN( Char_t * fcn ) {
  
  if ( (fcn) && (*fcn) ) {
    long IsInterpreted;
    long offset;
    G__ClassInfo cls;
    G__MethodInfo method;
    method = cls.GetMethod(fcn,"Char_t*,Int_t",&offset);
    if(method.IsValid()) {
      // In future we should also check the return type of function
      fFCN = (Int_t (*)(Char_t*,Int_t))method.PointerToFunc();
      IsInterpreted=G__isinterpretedp2f((void*)fFCN);
      switch(IsInterpreted) {
      case G__UNKNOWNFUNC: // this case should never happen
( ... )
      case G__BYTECODEFUNC:
( ... )
}

// This method sets the analysis function using function's address.
// Used by interpreted code only, make it visible to cint interpreter.
// The analysis function must be "known" to cint interpreter.

Bool_t TGoosyLMD::SetFCN( void * fcn ) {

    if(fcn) {
      Char_t *funcname;
      funcname = G__p2f2funcname(fcn);
      return SetFCN(funcname);         <---- this calls always SetFCN(Char_t*)
    }

    fFCN = TGoosyBuiltInDemoFCN;
    return kTRUE;

}
-----------------------------------------------
Seems that in case of G__BYTECODEFUNC I ALWAYS get the address of
the LAST LOADED ( via .L ) function ( in the above case "JH_DemoFCN" ).
I tried both "SetFCN(DemoFCN)" and "SetFCN("DemoFCN")" with the same
effect. This never happens when I compile these functions and place them
in shared libraries ( again .O0 doesn't seem to have any effect ).
Jacek.



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:21 MET