Implemented a marshalling of pointers for all types.

And added some test cases for (un)marshalling.