Xref: news2.mv.net comp.os.msdos.djgpp:4366 From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: How are args passed in DJGPP? Date: Tue, 28 May 1996 20:56:33 +0100 Organization: The University of York, UK Lines: 24 Message-ID: NNTP-Posting-Host: sgi6.york.ac.uk Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII In-Reply-To: To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp On Mon, 27 May 1996, Richard Philp wrote: > Just a simple question. I've got some assembler that I've assembled and > then use o2c to convert it to COFF. The thing is I can't get the assembler > to pass the correct value back to the program. Arguments from C to the assembler function are passed on the stack, the caller pushes them and then cleans up the stack after the asm function returns. The return value is normally in %eax, at least for integers. I would imagine pointers are the same, but floats and structures probably different. The easiest way to figure this out is to write a simple C function that takes some parameters and returns something, and compile it with -S. Take a look at the resulting .s file, and you can see exactly where gcc put everything... /* * Shawn Hargreaves. Why is 'phonetic' spelt with a ph? * Check out Allegro and FED on http://www.york.ac.uk/~slh100/ */