Xref: news2.mv.net comp.os.msdos.djgpp:6703 From: alaric AT abwillms DOT demon DOT co DOT uk (Alaric B. Williams) Newsgroups: comp.os.msdos.djgpp Subject: Re: return type of malloc? Date: Tue, 30 Jul 1996 17:12:02 GMT Lines: 51 Message-ID: <838746612.16082.9@abwillms.demon.co.uk> References: <4thu6e$nsr AT oravannahka DOT Helsinki DOT FI> NNTP-Posting-Host: abwillms.demon.co.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp reynders AT cc DOT Helsinki DOT FI (Joonas W N Reynders) wrote: > What type is the pointer malloc returns? Is it a selector:offset >pair, just a 32bit offset or what? The reason I need to know this is >that I've got a few routines made with MASM which copy information from >a mallocated buffer to SVGA buffer. Wow. That'll need total rewriting for DJGPP :-) All DJGPP pointers are 32-bit offsets into The Segment. DS, SS, ES, and CS all point to The Segment, or aliases thereof. Thus we can ignore segments alltogether, and just use [xyz] in assembler... or in AT&T syntax, just xyz. None of that LES xxx,xxx stuff. EG: C: int *ptr = malloc(sizeof (int)); ASSEMBLER: movl ptr,%eax // places the address of what is pointer to into eax movl $ptr,%eax // places the address of the pointer into eac and with an address in eax: movl (%eax),%ebx // loads ebx with the int eax points to I don't remember if movl (ptr),%ebx will work directly (probably will, try it and see) > Joonas ABW -- I have become... Comfortably numb... Alaric B. Williams Internet : alaric AT abwillms DOT demon DOT co DOT uk http://www.hardcafe.co.uk/Alaric/