Howdy rooters of the world. I have a problem concerning a shared function library I have generated. I'm using ROOT 2.25/03 on a dual i686 running RH6.1. I have the following files: Analyzer.C - function source file. Analyzer.h - header file with function prototypes and include statements. AnalyzerLinkDef.h - LinkDef used by rootcint when generating dictionary, has a.o. statements of the form #pragma link C++ function <function name>; for all the functions in my Analyzer. My problem is twofold. I.e. first I tried to put the global variable, i.e. those variable used by the functions in Analyzer.C, in Analyzer.h. I generated dictionary AnalyzerDict.C with rootcint -f AnalyzerDict.C -c <include directories> Analyzer.h \ AnalyzerLinkDef.h I then compile the object files Analyzer.o and AnalyzerDict.o, and finally I try to link my function library libAnalyzer.so from the mentioned object files. The result of this is a list of error messages due to multiple definition of the global variables I have in my Analyzer.h. The errors look like the following AnalyzerDict.o: In function `G___Init_7_33__FP8G__valuePCcP8G__parami': /heim/jens/brat/tpm1/AnalyzerDict.C:35: multiple definition of `gNameTPM1' Analyzer.o:/heim/jens/brat/tpm1/Analyzer.C:21: first defined here I then tried to move the global variable over to the top of my Analyzer.C file, and the it compiled with no error. However, I'd like to keep the global variable in the header file. Is there a way to do this? I tried to include statements of the form #pragma link C++ global <global variable name>; in my AnalyzerLinkDef.h, but no visible change in the compilation process. Secondly, when I run an interactive ROOT session, it would be nice to be able to se the content of these global variables. I.e. I simply would like to be able to do root [12] .p <global variable name> after I have called some of the functions in my function library. How can this be done. Can ROOT read global variables from a function library, or must the function library have a connection to a header file I load when I start my ROOT session? Any comments will be greatly appreciated. Thanks in advance. Jens Ivar --- Jens Ivar Jřrdre, Dep. of Phys., Allégt. 55, N-5007 BERGEN, NORWAY e-mail: JensIvar.Jordre@fi.uib.no, phone (temp.): (+47) 55 58 27 92
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:35 MET