Re: Library Design, f0dder's nightmare.
- From: "randyhyde@xxxxxxxxxxxxx" <randyhyde@xxxxxxxxxxxxx>
- Date: 23 Jun 2006 10:39:17 -0700
f0dder wrote:
In MS Win32 you can return just EAX and EDX for a HLL.
typedef struct MY_POINTER_AND_COUNT {
DWORD Pointer; // EAX (void *)
DWORD Count; // EDX (long)
} ;
MY_POINTER_AND_COUNT _mycall MyFunc ( ... ) ;
I've used to return SAFEARRAY of BSTRs in the commandline case,
though.
Hm, same way 64bit integers are returned, yes? I wonder how many compilers
support this? (I'd guess intel, VC, GCC - but what about smaller compilers
like DigitalMars?)
It's still pretty irrelevant for code like this tokenizer, though. But it's
worth keeping in mind for stuff that's called more often, sure.
AFAIK, the C standard says you can return structures from a function.
Exactly *how* those structures are returned is implementation
dependent, of course. I don't recall seeing the Intel ABI discuss what
happens when you return a 64-bit struct value, but EDX:EAX makes
perfect sense for most implementations. Of course, Intel's ABI (whether
or not it mentions 64-bit structs) is just a *suggestion*, so you can't
count on that, anyway.
Cheers,
Randy Hyde
.
- References:
- Library Design, f0dder's nightmare.
- From: hutch--
- Re: Library Design, f0dder's nightmare.
- From: japheth
- Re: Library Design, f0dder's nightmare.
- From: f0dder
- Re: Library Design, f0dder's nightmare.
- From: hutch--
- Re: Library Design, f0dder's nightmare.
- From: f0dder
- Re: Library Design, f0dder's nightmare.
- From: Eman
- Re: Library Design, f0dder's nightmare.
- From: f0dder
- Library Design, f0dder's nightmare.
- Prev by Date: Re: Library Design, f0dder's nightmare.
- Next by Date: Re: Book on Assembly
- Previous by thread: Re: Library Design, f0dder's nightmare.
- Next by thread: Re: Library Design, f0dder's nightmare.
- Index(es):
Relevant Pages
|