A pointer is a variable that holds a memory address, so the call memmove(addressof(a), addressof(b),...)
actually copies the address held by b
into a
so a
now points at the same memory location that b
points to. If that is what you desire, you're done.
If what you want is to set the value of the integer pointed to by a
to the same value as that of the integer pointed to by b
, then what you need is to copy the contents of the memory at the address pointed to by b
into the memory pointed to by a
. Like so...
memmove(cast(a, c_void_p).value, cast(b, c_void_p).value, sizeof(c_int))
now the pointer a
points to a memory address that holds a value similar to the value stored at the memory pointed to by b
.
the _objects
attribute is not necessary in both cases (IMHO)
Sorry for the boring post. But that I'm afraid is the (only?) way to do pointers :)