[Rivet] Plugin mechanism -- what do I do with the "extern" part?

Holger Schulz holger.schulz at physik.hu-berlin.de
Mon Jul 13 18:13:37 BST 2009


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







More information about the Rivet mailing list