www.delorie.com/djgpp/v2faq/faq148.html | search |
| Previous | Next | Up | Top |
Here are some gotchas in this context:
__attribute__((packed))
, to prevent GCC from inserting gaps between some members to make them properly aligned for faster access (see
how gcc aligns structs). C programs can declare the entire struct with the packed attribute, but C++ programs will need to declare each member with it, see
__attribute__((packed)).
dosmemget
or one of the _farpeekX
family of functions in conjunction with the _dos_ds
selector, and
don't forget to compute the linear address as segment * 16 + offset
.
__dpmi_simulate_real_mode_procedure_retf
to call it (don't forget to zero out the .x.ss
and
.x.sp
members of the __dpmi_regs
structure!).
int
s, whereas in DJGPP, an int
is 32-bit wide. You need to change the declaration of all struct members from int
to
short
, and from unsigned
to unsigned short
.
struct ncb { unsigned ncb_command; int ncb_status; char far *ncb_buffer; /* a far pointer to a buffer */ char ncb_name[32]; int far (*ncb_dispatch)(); /* a pointer to a far function */ };should be converted to this in a DJGPP program:
struct ncb { unsigned short ncb_command __attribute__((packed)); short ncb_status __attribute__((packed)); unsigned short ncb_buf_offset __attribute__((packed)); unsigned short ncb_buf_segment __attribute__((packed)); char ncb_name[32] __attribute__((packed)); unsigned short ncb_dispatch_offset __attribute__((packed)); unsigned short ncb_dispatch_segment __attribute__((packed)); };
webmaster donations bookstore | delorie software privacy |
Copyright ⌐ 1998 by Eli Zaretskii | Updated Sep 1998 |
You can help support this site by visiting the advertisers that sponsor it! (only once each, though)