[ROOT] CINT - function pointers

From: Elias Athanasopoulos (elathan@phys.uoa.gr)
Date: Sat Sep 04 2004 - 07:31:47 MEST


Hello!

The following code:

#include "CallFunc.h"
#include "Class.h"

double *fit(double *x, double *y)
{
  return 0;
}

int main(void) {
  
  long addr, offset;
  char *title = "fcn";
  int i = 0;
  int j = 3;
  int k = 6;

  char *cproto = "char*,void*,int,int,int"; 
  G__ClassInfo *klass = new G__ClassInfo ("TF1");
  G__CallFunc *func = new G__CallFunc();
  G__MethodInfo *minfo = new G__MethodInfo(klass->GetMethod("TF1", 
                                                            cproto, &offset));

  func->SetArg((long)title);
  func->SetArg((long)fit);
  func->SetArg((long)i);
  func->SetArg((long)j);
  func->SetArg((long)k);
  
  if (minfo->InterfaceMethod())
    func->SetFunc(*minfo);
  addr = func->ExecInt((void*)((long)NULL + offset));

  return 1;
}

produces the following error:

elathan@velka:/opt/root> g++ -Wall `root-config --libs --cflags` cf.C -o cf
elathan@velka:/opt/root> ./cf
Function:fcn cannot be compiled

Any hints?

Regards,
-- 
University of Athens			I bet the human brain 
Physics Department				is a kludge --Marvin Minsky 

	



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET