Hi Masaharu, I was already using the nestedclass and nestedtypedef pragmas (they were listed in my original e-mail). So, the problem/question remains - how do I import a function in a namespace even though I am already using the two pragmas that you recommend? If you look at my original e-mail, I attached all of the files that are necessary to run the following command: $ rootcint -f cross_sectionDict.cxx -c cross_section.hxx LinkDef.h Can you verify for me that you can actually run the above command without problems? Thank you for your help and expertise. Masaharu Goto wrote: > > Hello Matthew, > > You need to use > > #pragma link C++ nestedclass; > #pragma link C++ nestedtypedef; > > together with what you have tried. There is a historical reason that > cint does not activated nested classes by default. > > Thank you > Masaharu Goto > > > > >How do I export a function, which is nested in a namespace, from a > >shared library so that it is available from the CINT interpreter? > > > >Here is a concrete example of the function that I am trying to export > >from a shared library to CINT. The function, named "cross_section" (see > >below), is nested inside of multiple namespaces. Here is the contents > >of the header file which declares "cross_section": > > > > // cross_section.hxx > > namespace MDL > > { > > namespace WAB > > { > > double cross_section( double* variables, double* parameters ); > > } > > } > > > > > >Finally, here is the relevant part of the LinkDef.h file that I am > >trying to use to export "cross_section" from the shared library to the > >CINT interpreter: > > > > > > // LinkDef.h > > #pragma link C++ function MDL::WAB::cross_section; > > > > > >This doesn't work, as evidenced by the following error message when I > >try to run rootcint on these two files: > > > > > > $ rootcint -f cross_sectionDict.cxx -c cross_section.hxx LinkDef.h > > Note: link requested for unknown function MDL::WAB::cross_section > >FILE:LinkDef.h LINE:21 > > > > > >The pragma that I used (above) was the most straightforward method I > >could think of to export the function "cross_section". Since it didn't > >work, I also tried various combinations of the pragmas documented in the > >CINT Reference Manual (see http://root.cern.ch/root/Cint.phtml?ref and > >search for "#pragma"). In particular, I tried various combinations of > >the following two pragmas that seemed to have something to do with > >namespaces: > > > > > > #pragma link [C|C++|off] [class|struct|union|enum|namespace] [name]; > > #pragma link [C|C++|off] defined_in [class/struct/namespace name]; > > > > > >However, I could find no documentation on how to use these two specific > >pragmas. Would someone knowledgeable please instruct us in the use of > >these two pragmas? Would the use of some combination of these two > >pragmas solve my problem with exporting the "cross_section" function > >from a shared library to the CINT interpreter? > > > >I have attached both of the files "cross_section.hxx" and "LinkDef.h" in > >their entirety to this e-mail so that others could try and run the > >command > > > > $ rootcint -f cross_sectionDict.cxx -c cross_section.hxx LinkDef.h > > > >on them. Please let us know if you can find the correct combination of > >the CINT pragmas that allow rootcint to run properly on these two files. > >Thank you. > > > > > >-- > >Matthew D. Langston > >SLD, Stanford Linear Accelerator Center > >langston@SLAC.Stanford.EDU -- Matthew D. Langston SLD, Stanford Linear Accelerator Center langston@SLAC.Stanford.EDU 650.926.3279
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:22 MET