Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!nstn.ns.ca!news.cs.indiana.edu!sdd.hp.com!think.com!yale!bunker!jerrys From: jerrys@bunker.isc-br.com (Jerry Shea) Newsgroups: comp.windows.ms.programmer Subject: Re: GlobalAlloc by DLL Message-ID: <19270@bunker.isc-br.com> Date: 23 May 91 13:27:27 GMT References: <1652@msa3b.UUCP> <1991May21.224503.21936@hyper.hyper.com> Reply-To: jerrys@bunker.shel.isc-br.com (Jerry Shea) Organization: ISC-Bunker Ramo, an Olivetti Company, Shelton, Ct Lines: 26 In article <1991May21.224503.21936@hyper.hyper.com> bonneau@hyper.UUCP (Paul Bonneau,,) writes: >In article <1652@msa3b.UUCP> kevin@msa3b.UUCP (Kevin P. Kleinfelter) writes: >>I'd like to do a GlobalAlloc in a DLL, and have the memory owned by the >>DLL (not the application that calls the DLL). I don't mean I want to >>allocate the memory in LibMain; my application calls a DLL routine, and >>I want the DLL routine to GlobalAlloc. >> >From the "Guide To Programming", page 20-34 "When a DLL >allocates a global object, the application that called the >DLL owns that object". If you allocate the memory with the GMEM_DDESHARE flag set, it will be owned by the code segment that allocates it rather than by the task. This is one way of letting a DLL own the memory. I've tried this and it seems to work fine. I'm not sure if there are any other consequences of allocating memory this way though. Hope this helps, Jerry -- Jerry Shea | INET: jerrys@bunker.shel.isc-br.com ISC-Bunker Ramo, An Olivetti Company | UUCP: uunet!bunker!jerrys 2 Enterprise Drive | BIX: jshea Shelton, CT 06484 USA | Phone: (203) 337-1646