Linking ROOT macros under pyROOT?

Hi,

I have a ROOT macro that I wish to use under python.

#include "/path/to/includes/wseries.hh"

WSeries<double> mymacro() {

  WSeries<double> data=somefun();
  return data;

}

This macro compiles and works under ROOT
(I can do gROOT->LoadMacro(“mymacro.C+”).

However, when I attempt to load it from python

import ROOT ROOT.gROOT.LoadMacro('mymacro.C')

I get the following error

[quote]AutoDict_wavearray_float__cxx_ACLiC_dict.cxx:918: undefined reference to `wavearray::~wavearray()'
collect2: error: ld returned 1 exit status
Error in : Compilation failed!

RuntimeError Traceback (most recent call last)
in ()
----> 1 ROOT.gROOT.LoadMacro(‘mymacro.C’)

RuntimeError: (file “/home/ecm/AutoDict_WSeries_double__cxx.so”, line -1) Failed to load Dynamic link library /home/ecm/AutoDict_WSeries_double__cxx.so[/quote]

I guess this is because the linker doesn’t know about the WSeries library I’m using. How can I pass the location of the WSeries library to the linker?

Thanks,
Eric

Eric,

not sure what’s going on here when you compare ROOT v.s. PyROOT: both should give the same result. I notice, though, that the ROOT version uses ACLiC (the ‘+’), the PyROOT version does not. Is the destructor inline?

One other way is to load the library with ctypes.CDLL, another option is to change the libraries to link through gSystem.AddLinkedLibs().

HTH,
Wim