Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Misc > Re: Where's the...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 11 of 11 Topic 706 of 806
Post > Topic >>

Re: Where's the function result?

by Waldek Hebisch <hebisch@[EMAIL PROTECTED] > Dec 19, 2006 at 09:37 PM

Eli Gottlieb <eligottlieb@[EMAIL PROTECTED]
> wrote:
> I have an array of bytes, which are the arguments.  I have a function
> pointer to the function itself.  I have somewhere to put the result, and
> I know the size of the result.
> 
> I need a way to call the function without knowing its signature.  Given
> the data I do have, is this at all possible?
> 

In general impossible.  For example GNU Pascal on AMD64 on low level
uses default gcc system convention which is: first six integer-like
argument
go into integer registers, first six floating point arguments go into SSE
registers, 80-bit floats go into traditional floating point registers,
what does not fit go into the stack.  Small (up to 16 bytes)
agregates are passed in registers, type decides which one is used
(integer,
SSE or traditional floating point).  If aggregate has too complicated type
it goes into the stack.

Similar conventions are frequently used on RISC machines.  I do not
know what Microsoft uses for 64-bit Windows, but I suspect that they
use something similar to gcc convention.

As you see on AMD64 to correctly pass argument you must know their types.
Also, even if you know the types (say have an extra data describing them)
it is probably impractical to code "generic" call using a HLL -- doing
such call in assembler looks much easier.




-- 
                              Waldek Hebisch
hebisch@[EMAIL PROTECTED]

 




 11 Posts in Topic:
Where's the function result?
Eli Gottlieb <eligottl  2006-12-15 20:07:20 
Re: Where's the function result?
pgx@[EMAIL PROTECTED]   2006-12-17 19:36:50 
Re: Where's the function result?
Marco van de Voort <ma  2006-12-17 20:31:06 
Re: Where's the function result?
Eli Gottlieb <eligottl  2006-12-18 02:22:19 
Re: Where's the function result?
CBFalconer <cbfalconer  2006-12-17 22:15:13 
Re: Where's the function result?
Marco van de Voort <ma  2006-12-18 11:01:41 
Re: Where's the function result?
Eli Gottlieb <eligottl  2006-12-18 19:03:21 
Re: Where's the function result?
Marco van de Voort <ma  2006-12-18 22:04:19 
Re: Where's the function result?
Eli Gottlieb <eligottl  2006-12-18 22:15:30 
Re: Where's the function result?
Marco van de Voort <ma  2006-12-19 06:01:50 
Re: Where's the function result?
Waldek Hebisch <hebisc  2006-12-19 21:37:28 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Jul 6 6:17:10 CDT 2008.