Message-ID: From: Shawn Hargreaves To: djgpp AT delorie DOT com Subject: Re: VBE links in djgppfaq ?? Date: Mon, 29 Nov 1999 16:36:51 -0000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" Reply-To: djgpp AT delorie DOT com Alan Illeman writes: > Can someone help with converting this code for djgpp ?? This sort of code is very different in djgpp to in most other DOS compilers, so it may be easier to rewrite the same functionality in a djgpp style, rather than trying to convert old Borland or Watcom code. The djgpp User's Guide on http://www.delorie.com/djgpp/doc/ug/ would probably be a good place to start, and includes some working code snippets. > If I understand the faq correctly, djgpp packs structures automatically No, you have to use __attribute__ ((packed)) for that. For details, look at the info page: info gcc "c extensions" "variable attributes" > and so I should allocate a char buffer below the 1 Mb limit and use > the ansi macro "offsetof" to access the members.. > #define offsetof(s_type,mbr) ((size_t) &((s_type*)0)->mbr) I don't understand what you are getting at here. Memory below 1 MB is not directly accessible, but you can use the VBE calls to fill the transfer buffer with data, and then use dosmemget() to copy it into your local address space, after which you can use regular C to pull members out of the structure. You don't need offsetof() for this. > Can't I just use pragmas instead ?? > > #pragma pack(1) > typedef struct { > ... > }VGAINFO; > #pragma pack(0) gcc uses __attribute__ for specifying packed structures, not #pragma. But in any case this has nothing to do with the problem of getting the information from DOS memory into your address space. The User's Guide, and FAQ sections 18.4 amd 18.5, cover everything you need to know about this. Shawn Hargreaves.