Fixed the generation of 'ToInternal' to check for null only fields of a ref type.

Part of the patch by @ddobrev.
Added support for marshalling arrays of pointers to primitives.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>