RE: [ROOT] how to assign a void pointer to a structured pointer in ROOT(3.03/09)

From: Philippe Canal (pcanal@fnal.gov)
Date: Thu Apr 03 2003 - 19:43:40 MEST


> When I use this in an ordinary c++ source it is working. What is the
problem
> with this code ?..

In which other did you try you code and how did it fail?

My best guess at this point is that you tried it in CINT.  In that case you
may be missing the dictionary for DATEevent so that CINT does not know about
it.  To generate the dictionary it might be as simple as doing (assuming
that DATEevent is defined in an header file named DATEevent.h):

	.L DATEevent.h+

Cheers,
Philippe

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of ozgur cobanoglu
Sent: Monday, March 24, 2003 10:22 AM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] how to assign a void pointer to a structured pointer in
ROOT(3.03/09)


Hello,

how can I assign a void pointer to a structured pointer in a ROOT session?
When I do below and try to get the
variables declared in the structure, it gives me crazy numbers; I am using
an external library (libmonitor.so,
libshift.so) to load the file and first I must load (the library, very
first) the file and get its start point by a void pointer
-this is the only way in my case- after that I must assign it to a variable
that has embedded structure like that :

...
// headers are included, *.so files are loaded

struct DATEevent {    // embedded structure
   struct eventHeaderStruct header;    // ordinary structs
   struct equipmentStructMy payload;
  };

void* ptr;
struct DATEevent* event;
// here, make the pointer 'ptr' point the start of file in memory
event = (struct DATEevent*)ptr;

printf("%08x \n",event->payload.whatever.whatever.array[5]); // which is a
specific number like da1e5afe
...

When I use this in an ordinary c++ source it is working. What is the problem
with this code ?..

Thank you.

(pentium 3, linux7.2, ROOT 3.03/09)

--
----------------------------------------------------------------
Ozgur Cobanoglu           E-posta: ozgur@nucleus.istanbul.edu.tr
Istanbul Universitesi     Tel:     0090-212-511-84-80
Nukleer Fizik Bolumu      Fax:     0090-212-519-08-34
Vezneciler Istanbul       Mobil:   0090-505-512-72-90
34459 Turkiye
----------------------------------------------------------------
Ozgur Cobanoglu          E-mail:   Ozgur.Cobanoglu@cern.ch
CERN EP/AID              Tel:      +41 (22) 767 2382
CH-1211 Geneva 23        Fax:      +41 (22) 767 9585
Switzerland              Building: 53-R-024
----------------------------------------------------------------





_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


#################################################################
#################################################################
#################################################################
#####
#####
#####
#################################################################
#################################################################
#################################################################



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET