calling cernlib functions from within root

From: Hans Wenzel (wenzel@fnal.gov)
Date: Wed Oct 21 1998 - 12:06:57 MEST


Dear Rooters



Alos congratulations for 20000 downloads. I have a small problem using
the attached shell script i tried to generate the files so that i can
call cern library functions within root as described on the root web
page. Unfortunately I am getting the following messages.

Note: operator new() masked 1c
Note: operator delete() masked 1c
/tmp/cca024911.o: In function `main':
/home/wenzel/root/test/rootCERN.cxx:27: undefined reference to
`TRint::TRint(char *, int *, char **, void *, int)'

Any idea what I am doing wrong here?


cheers and thanks in advance for the help.

hans wenzel


IEKP Karlsruhe.



#! /bin/tcsh -f
rm -f CERNfunctions.h CERNLinkDef.h rootCERN.cxx CERN.cxx 
#
# create CERNfunctions.h
#
cat >!  CERNfunctions.h << "EOF"
#ifndef CERNfunctions_H
#define CERNfunctions_H

#ifndef ROOT_Rtypes
#include "Rtypes.h"
#endif

extern "C" Float_t denlan_(Float_t *x);
   
#endif
"EOF"
#
# Create   CERNLinkDef.h
#
cat >! CERNLinkDef.h << "EO"
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C function denlan_;

#endif
"EO"
#
# create dictionary CERN.cxx
#
rootcint -f CERN.cxx -c CERNfunctions.h CERNLinkDef.h
#
# create  rootCERN.cxx
#
cat >! rootCERN.cxx  << "EOF2"
/////////////////////////////////////////////////////////////////////////
//                                                                     
// Main program rootCERN.cxx to call CERNLIB functions
//
/////////////////////////////////////////////////////////////////////////
#include "TROOT.h"
#include "TRint.h"
#include <TROOT.h>
#include <TApplication.h>

#include "CERNfunctions.h"

extern void InitGui();
VoidFuncPtr_t initfuncs[] = { InitGui, 0 };

TROOT root("Rint","The ROOT Interactive Interface", initfuncs);

//______________________________________________________________________________
int main(int argc, char **argv)
{
   // dummy block to force the CERNLIB functions to be linked by C++
   if (0) {
      float x = 2.3;
      printf("denlan(x)=%g\n",denlan_(&x));
   }

   TRint *theApp = new TRint("Rint", &argc, argv, 0, 0);
   // TApplication *theApp= new TApplication("App", &argc, argv);
   // Init Intrinsics, build all windows, and enter event loop
   theApp->Run();

   delete theApp;

   return(0);
}
"EOF2"
#
#g++ -O -Wall -fPIC -I$ROOTSYS/include -c rootCERN.cxx CERN.cxx -o rootCERN.o    
# finally compile and link it 
#
g++ -g -I$ROOTSYS/include rootCERN.cxx CERN.cxx -o rootCERN /usr/products/cern/v97a/lib/libmathlib.a -L$ROOTSYS/lib -lNew -lBase -lCint -lClib -lCont -lFunc -lGraf -lGraf3d -lHist -lHtml -lMatrix -lMeta -lMinuit -lNet -lPostscript -lProof -lTree -lUnix -lZip -lGpad -lGui -lGX11 -lX3d -L/usr/X11R6/lib -lXpm -lX11 -lg++ -lm -ldl -rdynamic   



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