?: global function visible to ROOT's CINT

From: Dirk Meier (Dirk.Meier@cern.ch)
Date: Mon Mar 02 1998 - 20:45:29 MET


Hi,

I want to prepare some global functions and constants
which should be visible in ROOT. I found an example
for the constants, but with the functions it seems different.

Here what I tried:

// ----------------- this is DGlobalTools.h -------------
#ifndef _DGlobalTools_included_
#define _DGlobalTools_included_
#include <math.h>
#include "Rtypes.h"   // important to tell about ClassDef()

#define M_PI 3.14159265358979323846  // example to make constants global
double const gPI = M_PI;             // this gPI is really `visible'in CINT

float gPoly(float tArg ,float* p, int tOrder);  // now a function

class DGlobalTools {                 // and a class
 public:
  DGlobalTools(){;}
  void         Dummy();
  ClassDef(DGlobalTools,1)
};

with its implementation 

//--------------------- this is DGlobalTools.cxx
//*KEEP,DGlobalTools.
#include "DGlobalTools.h"
//*KEND.

ClassImp(DGlobalTools)

float gPoly(float tArg ,float* p, int tOrder){
  float f = p[0];
  for (int k = 1; k < tOrder; k++){
    f += p[k] * pow(1.*tArg,1.*k);
  }
  return f; 
}
void DGlobalTools::Dummy(){} // some other global mess to be prepared


and in LinkDef.h using  pragmas as described

#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class    DGlobalTools;
#pragma link C++ global   gPI;
#pragma link C++ global   gPoly;
#endif


The constant gPI is available in ROOT's CINT, but
gPoly is not. I also tried
#pragma link C++ function   gPoly;
which makes no difference.

What should I do to have gPoly() visible?

Dirk



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