|
[Rivet] Plugin mechanism -- what do I do with the "extern" part?Andy Buckley andy.buckley at durham.ac.ukMon Jul 13 22:05:20 BST 2009
Holger Schulz wrote: > Andy Buckley wrote: >> Holger Schulz wrote: >> >>> Hi, >>> >>> I wanted to try out Rivet's plug-in mechanism for analyses and I get >>> stuck >>> with error messages from g++ (4.3) of that kind: >>> >>> error: ‘AnalysisBuilders’ does not name a type >>> >>> I have implemented my analysis following the plug-in example on the wiki >>> page, except that I use a header file as well -- and this is where I >>> get stuck. >>> Do I have to declare the extern "magic" in the header file as well? >>> >> >> I'm not quite sure what you've put where, without a couple of code >> snippets, but the rationale for the 'extern "C"' bit is to declare the >> plugin hook without C++ symbol mangling (i.e. in the unmangled style >> used by the C language) >> >> So the normal way to use the plugin system is for only the .cc file to >> define and declare the "getAnalysisBuilders()" function, inside the >> extern declaration. Note that this function is decoupled from the >> analysis classes themselves. >> >> Anyway, that's mostly for general interest about how the loader system >> works... I suspect the real reason you are having build trouble is that >> the AnalysisBuilders type is not known (it is an std::map of function >> pointers, indexed by strings). Maybe you need to add '#include >> "Rivet/AnalysisLoader.hh"' to the .cc file in which your extern >> declaration of getAnalysisBuilders() is located? >> >> Andy >> >> > Um, yep that piece was missing. > > Is it possible to use a plug-in analysis together with a reference data > file? > Although the ref-data exists and I have set RIVET_REF_PATH, I get > this error: > > terminate called after throwing an instance of 'Rivet::Error' > what(): Couldn't find ref data file '.aida in $RIVET_REF_PATH, > /data/users/local/hschulz/Software/share/Rivet, or . > Aborted Looks like the analysis name isn't being set, hence the <NAME>.aida filename is just being generated as ".aida". But I guess that's why you asked about metadata files ;) You can also provide the name directly from the code by overriding the default MyAnalysis::name() method. Andy -- Dr Andy Buckley Institute for Particle Physics Phenomenology Durham University 0191 3343798 | 0191 3732613 | www.insectnation.org
More information about the Rivet mailing list |