Re: C struct members not seen in CINT

From: Patrick Decowski (decowski@mit.edu)
Date: Mon Jun 08 1998 - 18:19:01 MEST


On Mon, 8 Jun 1998, Damir Buskulic wrote:

> Hello everybody,
> 
> I'm trying to include a C library into ROOT. In one of the header files,
> there is a struct defined :
> 
> struct FrameH { 
>   unsigned int run;
>   unsigned int frame;
>   unsigned int GTimeS;
>   unsigned int GTimeN;
>   unsigned short ULeapS;
>   int localTime;
>   double dt;
>   struct FrVect *type;
>   };
> 
> This, in turn, is used as the output of a function FrameHNew which I
> want to use interactively :
> 
> struct FrameH *FrameHNew(char *name);
> 
> I build my linkdef file, ran rootcint (with a -p option) and everything
> seemed to work.
> 
> if I define a FrameH struct and call FrameHNew, it seems OK. But if I
> try to see an element of FrameH, for example
> 
> root [1] FrameH *frame
> root [2] frame = FrameHNew("demo");
> root [3] frame->run
> Error: No symbol frame->run in current scope  FILE:/tmp/daaaapuza LINE:1
> *** Interpreter error recovered ***
> 
> So I tried to include FrameL.h, the original header file. but that
> doesn't work because I have to use the -p option :
> 
> root [0] #include "FrameL.h"
> Limitation: can not handle macro FRAMELIB_DEFINED DONE Use +P or -p
> option
>  FILE:../FrameLSrc/FrameL.h LINE:10
> 
> I tried various options in rootcint but this doesn't seem to help
> 
> How can I send, in the interactive environement, the -p option to the
> interpreter ?
> Is it the right thing to do ?
> 
> How can I have access to the contents of my struct FrameH without
> loading anything, since I supposed it was already loaded in the shared
> library I made ?
> 
> -- 
> =====================================================================
> | Damir Buskulic                  | Universite de Savoie/LAPP       |
> |                                 | Chemin de Bellevue, B.P. 110    |
> | Tel : +33 (0)450091600          | F-74941 Annecy-le-Vieux Cedex   |
> | e-mail: buskulic@lapp.in2p3.fr  | FRANCE                          |
> =====================================================================
> mailto:buskulic@lapp.in2p3.fr
> 

hi damir,

you need to include a

#pragma link C++ class FrameH

in your LinkDef.h, then you will see the datamembers in your CINT
session. structures are just classes with datamembers defaulting to
public instead of private. you don't need to pass any -p options, CINT
will know about it once you include it in the shared lib.

hope this helps,
		patrick.

---------------------------------------------------------------------------
Patrick Decowski                           | ***NOTE: NEW OFFICE NUMBER*** 
24-504                                     |    Home:      (617)625-9352
Massachusetts Institute of Technology      |    Office:    (617)253-9735
77 Massachusetts Ave                       |    Fax:       (617)253-1755
Cambridge, MA 02139-4307                   |    
---------------------------------------------------------------------------
http://web.mit.edu/decowski/www/home.html  |    e-mail: decowski@mit.edu
---------------------------------------------------------------------------



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:33 MET