Next: , Previous: TFDDs, Up: BP Incompatibilities

7.2.10 Mem; Port; Ptr; Seg; Ofs; PrefixSeg; etc.

Those few routines in the System unit that deal with segmented pointers (e.g., Ptr) are emulated in such a way that such ugly BP constructs like

     PInteger (Ptr (Seg (a), Ofs (a) + 6 * SizeOf (Integer)))^ = 42

work in GPC, but they do not provide access to absolute memory addresses. Neither do absolute variables (which take a simple address in the program's address space in GPC, rather than a segmented address), and the Mem and Port arrays don't exist in GPC.

As a replacement for Port on IA32 processors, you can use the routines provided in the Ports unit, Ports. If you want to access absolute memory addresses in the first megabyte under DJGPP, you can't do this with normal pointers because DJGPP programs run in a protected memory environment, unless you use a dirty trick called near pointer hack. Please see the DJGPP FAQ (see DJGPP FAQ (the DJGPP FAQ)) for this and for other ways.

For similar reasons, the variable PrefixSeg in the System unit is not supported. Apart from TSRs, its only meaningful use in BP might be the setting of environment variables. GPC provides the SetEnv and UnSetEnv procedures for this purpose which you can use instead of any BP equivalents based on PrefixSeg. (However note that they will modify the program's own and its childs' environment, not its parent's environment. This is a property – most people call it a feature – of the environments, including DJGPP, that GPC compiled programs run in.)