Global variables in CINT

Hello,

I have some shared libraries which have some variables defined like this

static const double M_test = 0.938;

How do I make it accessible to cint?

That is how do I get a value to return when I run

root [0] M_test

… assuming I have loaded the library already?

Thanks,
Whit

You need to create a (ROOT-)CINT “dictionary entry”, for each of your global variables, using LinkDef lines in form: #pragma link C++ global M_test;

This does not work. I in fact already had this included.

I want them to be defined globally when I first run root.

If I remove static, it works! Not exactly sure what static does here…

Now I noticed your “static const” … see, for example, … http://stackoverflow.com/questions/177437/const-static and http://stackoverflow.com/questions/1674032/static-const-vs-define-in-c

Ah ha.
I understand the difference now.

As a work around, I just added all the constants to a namespace instead and added the namespace to my linkdef file. Also added using blah::some_const; for each constant.
Then I just added to my rootlogon.C:

using namespace blah;

Then it works just how I want it.

Thanks for your help!

Cheers,
Whit