Quote:
Originally Posted by idrougge
Thanks, I solved it using some inline assembler, but it's nice to see that there is a system call for doing it as well. And as usual, Blitz's online help is of no help – according to it, CopyMem_ takes arguments in parentheses. Your example is correct – no parens.
I was hoping there was a simpler way than actually copying memory, though.
|
CopyMem_ is a systemcall. Please make sure you add proper checks if you going to use it.
The solution depends on what you want:
Do you really want to COPY the type? If not, you could (but must not!
) try to bend a pointer temporarily to the src address:
Code:
Newtype.foo
a.w
b.w
c.w
End Newtype
Deftype.foo tsrc
tsrc\a=10,20,30 ;put in some values
*tdst.foo = tsrc ;"clone" the struct by taking over the address
if *tdst
NPrint *tdst ;should be = &tsrc
NPrint *tdst\a
NPrint *tdst\b
NPrint *tdst\c
;
*tdst=0 ;make sure we are not trying to free that later (GURU)
endif
MouseWait
End