Author Topic: Return values from functions  (Read 6215 times)

Offline hhh3h

  • Jr. Member
  • *
  • Posts: 41
Return values from functions
« on: June 23, 2011, 06:21:37 PM »
Greetings.  A few months ago I was reading something on Wikipedia (I think) about what exactly gets returned from a function that you call in another assembly.

If I recall, it said that not just the value itself is returned, but other information as well, such as an integer indicating whether or not the function encountered an exception.

Well, unfortunately I cannot find that page and I am out of ideas as to what terms to search.  I believe it is related to Calling Convention, Name Mangling, and Application Binary Interface (ABI) because those were the topics I was reading about when I came across this.

I was wondering if anyone knows what I'm talking about and can give me the correct term to search.

Thanks.

Offline JoeCoder

  • Jr. Member
  • *
  • Posts: 72
  • Country: by
Re: Return values from functions
« Reply #1 on: June 23, 2011, 06:37:43 PM »
I guess you are talking about x86 (believe it or not that is not the only platform in the world  :D ) but you didn't say Windows/Linux/Solaris/BSD/DOS/etc.

We discussed some of this recently here http://forum.nasm.us/index.php?topic=1119.0 Specifically, look for Keith's link to Agner Fog's (and they thought my name was funny) calling conventions guide. I call it linkage conventions and it's also part of any normal API definition but I'm not sure if that's what you are looking for or specific information for some platform/OS combo.

If you are asking about MVS on S/370 or later I can help. Otherwise somebody else here will!
If you can't code it in assembly, it can't be coded!

Offline hhh3h

  • Jr. Member
  • *
  • Posts: 41
Re: Return values from functions
« Reply #2 on: June 24, 2011, 05:52:30 PM »
Thanks for that link; it has some links within it that are quite informative.  Specifically 1 and 2.

I guess in regard to your architecture question, I was talking about x86 and/or x86-64; and in regard to OS, I was not interested in just one specific OS, but rather the differing conventions between each major OS (Win/Linux/BSD, etc).