Hi, Now I can call the function from the interpreter, but the pointers that are passed to the function are not passed correctly. This function is a minimization function for TMinuit, so it has the format: void (*)(Int_t&, Double_t*, Double_t&f, Double_t*, Int_t) The problem I have is with the fourth parameter. TMinuit Eval function pass a valid address when it calls the function, but in the function implementation, the address read for the fourth parameter is wrong (0xa) and it causes a segmentation fault. Actually, my LinkDef.h for this function is ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ function QExtendedLikelihood; #endif and I produce the corresponding dictionnary file using command: rootcint -f QExtendedLikelihoodDict.cxx -c QExtendedLikelihood.h LinkDef.h Thanks Pierre-Luc Drouin On Thu, 26 Jun 2003, Stanislav Nesterov wrote: > Hi, > > In this case when generating dictionary add to the LinkDef.h file: > > #pragma link C++ function MyFunction; > > And then proceed as usual, i.e. compiling dictionary, linking, etc. > > Best regards, > Stanislav. > On Thu, 26 Jun 2003, Pierre-Luc Drouin wrote: > > > Hi, > > > > I've a function (not a class member function) that I want to be able to > > call from the ROOT interpreter. I want a compiled function contained in a > > share library. I'm used to include my classes using > > rootcint and ClassDef, ClassImp statements in my code, but with C style > > functions, I don't really know how to proceed. Suppose my function header > > file is > > > > =====MyFunction.h==== > > #include <cstdio> > > void MyFunction(); > > > > and the source file is > > > > ====MyFunction.cxx=== > > #include "MyFunction.h" > > void Myfunction(){ > > printf("Hello Wolrd\n"); > > } > > > > What should I do if I want to be able to call MyFunction from the > > interpreter, if the function is compiled in a shared library? > > > > Thanks > > > > Pierre-Luc Drouin > > > > >
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET