This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Error modifiying Cyg_Thread class...


The way they implemented the C compatability layer was by defining C
structures that match the C++ classes exactly, that way you can do casts
etc. So, for every C++ class that someone might access there is a
corresponding C structure in kernel/include/kapidata.h, and if you add
something to the C++ class you should also add it (in the exact same
spot) into the C structure.

One thing to note, if you enable assertions in your kernel then things
like this will cause a halt, since there are a bunch of assertions to
check structure vs. class sizes at startup.

-Dan

> -----Original Message-----
> From: Cristiano Ligieri Pereira [mailto:cpereira@ics.uci.edu]
> Sent: Saturday, July 07, 2001 9:27 AM
> To: ecos-discuss@sourceware.cygnus.com
> Subject: [ECOS] Error modifiying Cyg_Thread class...
> 
> 
> 
> Hi all,
> 
> I was trying to add an extra field to the class Cyg_Thread (file
> thread.cxx) and was getting a strange behavior. The field is 
> a cyg_uint16
> and I was adding it to the end of the class definition, right 
> after the
> get_unique_id() method. In addition to the variable itself, I was also
> adding two accessing functions, one to set and another to get 
> the value of
> this variable (something very simple :-)).
> 
> After recompiling the code and testing I've noticed that the 
> value I was
> setting wasn't being held and when issuing the "get" I was getting a
> different value. After struggling for a few hours I changed 
> the variable
> definition to the beginning of the class, right after the 
> definition of
> the variable unique_id, and everything started working fine.
> 
> Can someone explain me why is that?
> 
> Sounds like some alignment problem, but it is not clear to me 
> why exactly
> it wasn't working...
> 
> Thanks,
> Cristiano.
> 
> ------------------------------------------------------------
> Cristiano Ligieri Pereira - http://www.ics.uci.edu/~cpereira
> 
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]