C call makes exception #13 wake...

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
proxy

Re:C call makes exception #13 wake...

Post by proxy »

a more reliable way to change the packing for a whole structure is like this:


(GCC Specific)

Code: Select all

#pragma pack (push, 1)
struct MyStruct {
uint16_t member1;
uint32_t member2;
};
#pragma pack(pop)
this structure will have a size of 6 which is what is wanted.

proxy
Googles

Re:C call makes exception #13 wake...

Post by Googles »

It doesn't work for me... does it matter if I use the -O3 param when compiling.
User avatar
Colonel Kernel
Member
Member
Posts: 1437
Joined: Tue Oct 17, 2006 6:06 pm
Location: Vancouver, BC, Canada
Contact:

Re:C call makes exception #13 wake...

Post by Colonel Kernel »

Re: Packing structure members...
I use the -fpack-struct switch with GCC and it works for me.
Top three reasons why my OS project died:
  1. Too much overtime at work
  2. Got married
  3. My brain got stuck in an infinite loop while trying to design the memory manager
Don't let this happen to you!
Googles

Re:C call makes exception #13 wake...

Post by Googles »

I tried that too but GCC wouldn't even execute then...
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:C call makes exception #13 wake...

Post by Pype.Clicker »

what sort of GCC version are you using ?

`-fpack-struct'
Pack all structure members together without holes.

*Warning:* the `-fpack-struct' switch causes GCC to generate code
that is not binary compatible with code generated without that
switch. Additionally, it makes the code suboptimal. Use it to
conform to a non-default application binary interface.
So i'd rather use a structure-local stuff than trying to pack all structures by default ...
proxy

Re:C call makes exception #13 wake...

Post by proxy »

are you sure the pragma doesn't work for you? I have never seen any case where it fails to perform as expected...perhaps you misused it?

proxy
Post Reply