Microsoft C 5.1 question

michael k finegan mfinegan at uceng.UC.EDU
Thu Jan 26 13:10:50 AEST 1989


I have been having a problem with far pointer conversion in MSC 5.1, using
the medium memory model. It goes like this: in medium model code pointers
are 32 bits, while data pointers are 16 bits. There is an exception to the
data pointer size, and that is done using the keyword far.
    What I am trying to do is put an address into a far data pointer
(unsigned char far * ptr), which works okay at first, but when the global
pointer gets accessed in a subroutine, low and behold - it is different! It
appears that the high order word is zeroed out ... My question: has anyone out
there in net land put addresses into far pointers in medium model with success?
Is there a trick?
 The people at MSC claim it should work, but they haven't tried to code it ...

(By the way - I am using buildptr(segment,offset) from the LIM specs. to 
instantiate the pointers: the far pointer is treated as an unsigned long, and
the segment is shifted left 16 and added to the offset to create the far ptr)
				Thanks,
					Mike Finegan
					mfinegan at uceng.uc.edu
				



More information about the Comp.lang.c mailing list