Using GSL in ROOT

I found this post that describes how to build a CINT dictionary for GSL ( It works fine with gsl_sf_bessel.h (the header used in the example), but if I try it with a different header I get “… is not defined in current scope” when I try to use some functionality of the library.

For example:

root [0] gSystem->Load("/usr/lib/"); root [1] gSystem->Load("/usr/lib/"); root [2] gSystem->SetIncludePath("-I/usr/include"); root [3] gROOT->ProcessLine(".L /usr/include/gsl/gsl_math.h+"); Warning in <ACLiC>: /usr/include/gsl is not writeable! Warning in <ACLiC>: Output will be written to /tmp/foobie Info in <TUnixSystem::ACLiC>: creating shared library /tmp/foobie//usr/include/gsl/ root [4] printf("Should be 9: %d\n", int(gsl_pow_2(3))); Error: Function gsl_pow_2(3) is not defined in current scope (tmpfile):1: *** Interpreter error recovered ***

Am I missing something here?


By default ACLiC generate the dictionary only for the symbols defined in the file (and a header file with the same name if any).

So is gsl_pow_2 declared in gsl_math.h? If it is, is it a real function or a CPP macro?


Ahhh, the problem was that the function was actually defined in “gsl/gsl_pow_int.h” which was an included header in “gsl/gsl_math.h”. Thanks for the help.

You say that that is the default behavior of ACLiC. Is there an easy way to make it also generate the dictionary for included header files? I read chapter 7 of the user’s guide and the answer to this still wasn’t clear to me. It doesn’t make a huge difference, but it would be convenient.

Thanks again!

[quote]Is there an easy way to make it also generate the dictionary for included header files?[/quote]Sorta (you would need to turn on default pragma linking and write a linkdef for your file for ACLiC) but this is not what you want :slight_smile:. This would generate the dictionary for every single header it sees including all the system headers.

There is a directive that you can use #pragma link C++ defined_in filename; to create a custom file (that would #include and #pragma link all the needed headers) but in older version of ROOT the filename needed to be a full path name.

The easiest is simply to .L filename.h+ all the header you need.