Date: Mon, 4 Mar 1996 15:42:57 +0000 (MET) From: C M Marka To: djgpp AT delorie DOT com Subject: C++ packing/DPMI Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII !!!please ignore the return address, since this message is being posted from my friend's account!!! Reply to: Martynas DOT Kunigelis AT vm DOT ktu DOT lt I found out how to make GNU C++ compiler pack the ffblk structure in correctly, so you can use findfirst() and findnext() from your C++ programs. I know my method is undocumented and non-elegant, but it *works*. You just need to edit your file like this: ----dir.h------ ... ... ... #ifdef __cplusplus extern "C" { #pragma pack(1) <---- here's our hack! #endif ... ... ... ... #ifdef __cplusplus } #pragma pack() <---- here we go again #endif ... ... In any case, you'll be able to remove #pragmas from your file when GNU fixes the bug in cc1plus [ and/or removes support for #pragma ]. I've also some questions about DPMI, so I think they go to C. Sandmann: [1] When try to allocate a real mode callback and pass the address of a real mode call structure to DPMI function 0x0303, does it copy structure's contents to some internal buffer or does it use the original one (the one I passed)? If so, do I need to lock it? [2] It is said in the FAQ that changing the PM int vector automatically changes the appropriate RM vector. Why and how? I've spent whole weekend trying to get a mouse event handler to work, but all I got were hundreds of reboots. Here's what I did [ in assembler ]: 1. lock the handler code and RM Call structure 2. allocate a real mode callback (passing a locked struct to DPMI) 3. `simulate real mode interrupt' 0x33 with AH=0x0C and ES:DX = return values of step 2 (plus other parms, and SS:SP = 0) in RM call struct. I check for errors after each step, but step 3 never returns. I though it could be caused by too small stack, but it's not, I tested it: I allocated some DOS mem, put a RETF opcode there, and did step 3, and it was ok. After hundreds of failures I tried to write a RM timer int handler. The handler just increased a counter on the screen (0xB8000 byte). It got called only 2 times, and then -- my my, reboot again. I think this is not caused by high interrupt frequency and reentrance problems -- default 18.2 secs is not that high, is it? So can someone help me or show a `live' example of setting a mouse event handler with int 33/AH=0C? Or maybe a RM hw interrupt handler? Please? P.S. I tried to check sb_lib, but it's rather messy. Please help. Martynas Kunigelis P.P.S. Could someone mail me any info about the vertical retrace interrupt? All I know about vert. retr. for now is just how to wait for it... :(