elhadad@cs.columbia.edu (Michael Elhadad) (01/24/91)
I'm trying to understand when and why to use GlobalDosAlloc as opposed to GlobalAlloc. Assume I am running in enhanced mode. The only difference I have read in the doc is GloabalDosAlloc will allocate the memory under the 1M line. Why should that make a difference to an application? Under what circumstances should I look at it? What's the connection with EMS (if any)? Anybody has experience with that? Thanks, Michael
risto@tuura.UUCP (Risto Lankinen) (01/24/91)
elhadad@cs.columbia.edu (Michael Elhadad) writes: >I'm trying to understand when and why to use GlobalDosAlloc as opposed to >GlobalAlloc. Assume I am running in enhanced mode. The only difference I >have read in the doc is GloabalDosAlloc will allocate the memory under the >1M line. Why should that make a difference to an application? Hi! There are two cases I can think of, where GlobalDosAlloc() would be prefer- able to GlobalAlloc() : - For data items, pointer to which is passed to certain INT calls, some of which run in real mode, and can therefore use the bottom 1M only - For co-operationg DOS/Windows apps, which would communicate thru common memory, that's addressable by both Related Q: There's also function GlobalWire() , which is somewhat 'stronger' way to lock a memory block. Its documentation says, that the block is first moved to a lower address before locking. The handle received seems to be usable in an interrupt server running in a 286 system (standard mode). I'm in doubt of whether this implies, that the block is *always* moved all the way down to the first 1 meg, failing in case of no free space there (as opposed to using a higher address instead). Any way to check, ie. to allocate all of the *DOS* memory, but none other (a'la GlobalAlloc(-1) or GlobalCompact() )? Today's slogan: "There are three kinds of memory in an XT: Extended, Expanded and Exhausted." - R.L. Terveisin: Risto Lankinen -- Risto Lankinen / product specialist *************************************** Nokia Data Systems, Technology Dept * 2 2 * THIS SPACE INTENTIONALLY LEFT BLANK * 2 -1 is PRIME! Now working on 2 +1 * replies: risto@yj.data.nokia.fi ***************************************
ed@odi.com (Ed Schwalenberg) (01/24/91)
In article <ELHADAD.91Jan23121418@mermaid.cs.columbia.edu> elhadad@cs.columbia.edu (Michael Elhadad) writes:
I'm trying to understand when and why to use GlobalDosAlloc as opposed to
GlobalAlloc. Assume I am running in enhanced mode. The only difference I
have read in the doc is GloabalDosAlloc will allocate the memory under the
1M line. Why should that make a difference to an application?
The only real reason for using GlobalDosAlloc is that your Windows application
wants to share memory with a DOS application (like a TSR) which can only access
memory under 1MB. Note that GlobalDosAlloc returns TWO addresses: a selector
which can be used in protected mode and a paragraph-segment value for the
real mode (i.e., DOS) program to use. Normal Windows applications don't ever
use GlobalDosAlloc.