flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Teehee 12 Jan 2010, 09:20
Why to pass a whole structure if its very much faster to pass a pointer to it?
Anyway, i dont know if its possible. So lets wait the answer ![]() |
|||
![]() |
|
baldr 12 Jan 2010, 12:19
Teehee,
This is the difference between parameter passing by value and by reference. In the former case callee gets private copy of parameter and changes are not reflected back to passed parameter. In the latter case (when pointer to structure is passed), callee can modify passed parameter. alorent, FASM's invoke is a macro, not a directive as in MASM. It's functionality can be extended by yourself. Stock macro simply pushds parameters and indirectly calls given function (i.e. first parameter of invoke is dereferenced to obtain function's address: invoke ebx, v will generate pushd v / call [ebx]). Extended include files (e.g. Win32AX.Inc) define pushd macro to augment invoke functionality, for example, with ability to use nested invokes as parameters. Probably there is a way to implement something like byval parameter qualifier in pushd (like it's done with addr and double) to pass struct parameter by value, this will involve some kind of type information being attached to it. Anyway, you can decompose struct into fields and pass them individually (does your function need copy of them all?). |
|||
![]() |
|
Teehee 12 Jan 2010, 14:57
ohh, gotcha!
|
|||
![]() |
|
alorent 13 Jan 2010, 08:12
Thanks guys!
I guess that's better to pass just the pointer. I was asking to reuse some code from MASM (in external OBJs) Thanks!!! |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.