delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/09/30/21:55:43

Message-ID: <01BBAF17.6136A3A0@nj-dialup200.cnct.com>
From: John Panettiere <jmarco AT cnct DOT com>
To: John Panettiere <jmarco AT cnct DOT com>
Cc: "djgpp AT delorie DOT com" <djgpp AT delorie DOT com>
Subject: RE: packed data structures?
Date: Mon, 30 Sep 1996 21:35:47 -0400
MIME-Version: 1.0

Thank you for help!

Another fellow explained the problem - it seems that the =
__attribute__((packed)) system doesn't work under C++ (which is what I'm =
doing), and that the workaround is to surround the structure with

#pragma pack(1)

#pragma pack()

I added that description of what I was doing and why the sample vbe code =
didn't help in case anyone glimpsed at my letter, saw that I was writing =
vbe code, and recommended that I look at the sample code - that advice =
wouldn't have been helpful, so I decided to spell out the measures I had =
already taken.

Thanks again!

John Panettiere


----------
From: 	Leath Muller[SMTP:leathm AT gbrmpa DOT gov DOT au]
Sent: 	Monday, September 30, 1996 8:59 PM
To: 	John Panettiere
Cc: 	djgpp AT delorie DOT com
Subject: 	Re: packed data structures?

> At first I didn't know why my VBE2 code wasn't working, but then I
> realized that djgpp wasn't packing the data structures - so I browsed
> the info files and found "__attribute__((packed))", which seemed to be
> the answer I was looking for.  I applied this attribute to every field
> in all of my VBE2 data structures, but the problem still seemed to
> remain - 16 bit fields were being padded!  Is there a known problem
> with packing, or is there something I'm overlooking?

Are you sure you have defined the structures correctly? I do this
exactly as you have stated, and have no problem at all with it. How
are you defining your 16 bit fields? You should be using short int's...
:)=20
=20
> I've already downloaded the vbe2 sample code that is mentioned in the
> faq, in fact its what my code is largely based on.  The author of that
> code doesn't go through the entire list of videomodes using the
> "VideoModePtr" field returned in the VbeInfoBlock structure; this is
> something I need to do and is at the heart of my present predicament.

I'm confused. :)  Are you:
i)	asking how to go through all the video modes; or
ii)	saying that the non-packing of your structure effects the looking
	up of all video modes?

If you need help, mail me... :)

Leathal.



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019