TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Dean Roddey
from: Dan Larson
date: 1994-11-15 18:23:04
subject: 16-BIT TO 32-BIT CALLBAC

DR>Thanks Dan Larson for your msg about 16-BIT TO 32-BIT CALLBAC, on
DR>Wednesday, 11-09-1994!

DL> Is there a proper typ
DL> 
DL> casting from 16-bit void to 32 bit void or other types? I would
DL> have a lot of work ahead of me if I had to edit all of those headers
DL> to  

DR>If you are in a 32 bit compiler, then to cast a 16bit pointer to a 32
DR>bit pointer would be:

DR>VOID*    _Seg16    p16Pointer;
DR>VOID*    p32Pointer;

DR>p32Pointer = p16Pointer;

This compiler thinks the void * parameter is 32-bit and will thunk it from 32 t

16 even though it is already actually 16 bit since the dll is passing it to the
call back routine. If I replaced the p16Pointer with the void * param, the
compiler does no thunking because it thinks the void * param is already 32-bit.


DR>It should be that simple. Since the types of both are known from their
DR>declarations, the compiler should correctly do the cast. I guess you
DR>could always be more explicit (which would also make the code more self
DR>documenting)

DR>p32Pointer = (VOID*)p16Pointer;

DR>But, technically speaking, that would be redudant. If this does not
DR>work for you, then I think maybe your compiler (which one??) is not a
DR>happy camper (or I am very confused, which is always another option.)

I am using IBM Cset++ 2.01. Maybe I am doing something wrong, but the IS my
first attempt at modifying headers from and existing 16-bit DLL. So far I have
changed all func prototypes from far pascal to _Far16 _Pascal, then all pointer

inside data structures to _Seg16 * instead of far *, as well as pointer to
pointers. 

___
 * MR/2 1.52 NR * What color is a chameleon on a mirror?

--- WILDMAIL!/WC v4.10h

* Origin: Freezing Point BBS - WDNet HQ - Mpls MN: (1:282/85.0)
SEEN-BY: 12/2442 54/54 620/243 624/50 632/348 640/820 690/660 711/409 410 413
SEEN-BY: 711/430 807 808 809 934 942 949 712/353 623 713/888 800/1
@PATH: 282/85 1 270/101 396/1 3615/50 229/2 12/2442 711/409 54/54 711/808 809
@PATH: 711/934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.