Not sure if this is related to CEGUI buuuuuuuuuut.....

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
wingdongdoodle
Just popping in
Just popping in
Posts: 15
Joined: Tue Mar 15, 2005 21:41

Not sure if this is related to CEGUI buuuuuuuuuut.....

Postby wingdongdoodle » Fri Mar 25, 2005 13:04

well, i've been having great success gettign CEGUI and OPENGL working, im setting up a simple framework and some classes that will make it a lot easier to set up GUIS using CElayout editor and such.

Ive also recently started tryign to integrate Raknet (a very nice networking library) with all my code. however...

raknet requires (? maybe not REQUIRES but as far as i know at this point) a struct to send data through packets, and this struct needs the #pragma pack(1) .

so i wrote a .H file that contained my struct:
#pragma pakc(1)
struct CQubitB92{
unsigned int typeID;
unsigned int mLinearAngle;
}

since i just typed a lot of code, i decided to compile and give it a test (make sure no types since i did write it at 5 am :roll: ). it compiled, ran fine, etc.

until i exit. my program crashes on my applicatiosn destructor on this command:

if(CEGUI::System::getSingletonPtr())
delete CEGUI::System::getSingletonPtr();

the error message i get is: DAMAGE: after normal block (467) *numbers*

nowhere in my code do i even instatiate a instance of the struct. If i comment out #pragma pack(1), then the code works fine...


I'm not sure what is causign the problem, it could be me (i have never used the pack() thing before, just learned it a few hours ago) or something weird.


anywho, any ideas would be welcome. (btw, im on visual c++ 7.1, and i have the newest compilers for it, i downloaded the newest Visual Toolkit and got that workign with my IDE)




EDIT:

ok, after much more research/forum searching, i discovered that i should #pragma pack(push) .... #pragma pack(pop) and this gets rid of my problem. Still, anyone know why i was getting that problem above? im assuming now that memory was overwritten somewhere?

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Not sure if this is related to CEGUI buuuuuuuuuut.....

Postby CrazyEddie » Fri Mar 25, 2005 15:03

I have no explantion for you, I've never used the #pragma pack either :?

The only thing that springs to mind is some wierdness caused by compiling the lin with one setting and somehow getting a different setting when using the library. I know that's far fetched, since pack is only supposed to affect the construct immediately following it.

Very odd.

CE.

User avatar
kitt3n
Just popping in
Just popping in
Posts: 17
Joined: Wed Jan 12, 2005 12:06

Re: Not sure if this is related to CEGUI buuuuuuuuuut.....

Postby kitt3n » Sat Mar 26, 2005 23:16

#pragma pack(1) will cause all folowing structs
to be byte-aligned

You nicely see the result like this:

<whatever #pragma pack here>
struct myStruct
{
char myBytes;
int myInt; // If aligning on 4-byte boundaries
// myInt will start 3 bytes further
// than myBytes (ie 3 bytes are 'lost'
// #pragma pack(1) is great for structures
// you wanna write to disk - at the cost
// of some performance (non-aligned data
// is slower
};

int mySize = sizeof (myStruct);


Damage after normal block is usually a memory-boundary
error... You might try boundchecker -
or alternatively rip down your program until the error
doesn't occur anymore :)

User avatar
gcarlton
Just can't stay away
Just can't stay away
Posts: 149
Joined: Wed Jan 12, 2005 12:06

Re: Not sure if this is related to CEGUI buuuuuuuuuut.....

Postby gcarlton » Sun Mar 27, 2005 01:58

The crash will be that your side defines structs as packed, but the cegui library is compiled without them packed, and as such you'll get weird problems, since the code will assume two different sizes at different points.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 5 guests