From: kagel AT quasar DOT bloomberg DOT com Date: Fri, 3 Jan 1997 09:14:33 -0500 Message-Id: <9701031414.AA17450@quasar.bloomberg.com > To: rbrooks AT utdallas DOT edu Cc: djgpp AT delorie DOT com In-Reply-To: <5ahrj3$crt$1@news.utdallas.edu> (rbrooks@utdallas.edu) Subject: Re: Memory management in DJGPP Reply-To: kagel AT dg1 DOT bloomberg DOT com From: rbrooks AT utdallas DOT edu (Rusty L Brooks) Date: 3 Jan 1997 02:40:35 GMT I have a few questions about djgpp... since I am learning C++ from a different C++ book, there is some difficulty... First of all, gcc doesn't seem to handle the keyword far, as in: char far *harf; This was mentioned in the info libc.a help files... How can I maintain a similar functionality? You do not need to. The 'far' keyword is an Intel 16bit artifact. It is required to access data in the 'far' heap which is more than 64k away from the default data segment. DJGPP generate 32bit code with a flat memory model. Up to 4GB of virtual memory is available as a single segment so there is not practical need for 'far' pointers in this sense. (DJGPP does have a set of library functions which deal with a type of far pointer used for accessing real memory addresses such as hardware buffer addresses. This may be part of the answer to your second question. Check the FAQ and Info pages for details. Also browse the back postings for discussions on this.) Secondly, if I want to pass a memory value to a pointer, how do I go about doing this? (Both for far pointers and near pointer) I get a warning about casting harf (see above) to an int without a cast if I try something like: char *harf = 0x0013 or something similar. The message is because you are performing an implicit cast of the short integer 0x0013 to a char pointer in order to do the assignment to harf. You need to make the cast explicit to eliminate the warning. Try: char *harf = (char *)0x0013; However, remember that DJGPP deals with virtual memory addresses not physical addresses (0x0013 looks suspiciously like an I/O port or other physical address to me). You cannot directly access physical memory addresses (such as memory mapped I/O ports) by assigning a physical address to a pointer in DJGPP code. If the address you want to assign is a hardware buffer or other physical memory or port address there are several special ways that this can be done. Email replies appreciated, but I *do* read the group, so posting here is ok too. -- Art S. Kagel, kagel AT quasar DOT bloomberg DOT com A proverb is no proverb to you 'till life has illustrated it. -- John Keats