www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/11/22/13:21:28

Date: Wed, 22 Nov 1995 18:02:30 +0300
From: "Alexander V. Lukyanov" <lav AT video DOT yars DOT free DOT net>
To: djgpp AT sun DOT soe DOT clarkson DOT edu, ngh94 AT aber DOT ac DOT uk
Subject: Re: ASM functions returning values

> From: ngh94 AT aber DOT ac DOT uk (NIGEL  HUGHES)
> Date: 21 Nov 1995 13:27:22 GMT
>
> Dear All,
> 	Quick question. I have some asm routines (in a separate
> ..S file which I link in) and have parameters being passed OK no
> probs. The question I have is, where do I leave a value so it
> is returned by the function? Stack a register (%eax sounds likely) or what?
>
> 	e.g.
>
> 	long leg;
>
> 	leg=my_asm_function();
>
> Thanks in advance,
>
> Nigel
>

I don't know exactly, but you can easily figure this out by compiling a
test program to assembly, like this:

test.c:
long test()
{
  return 16L;
}

gcc -S test.c

As the result you will have .s file, in which you can see how the return value
is passed.

---
Alexander Lukyanov
lav AT video DOT yars DOT free DOT net

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019