G
Guest
I'm trying to co-erce a __gc array of Byte to a __nogc pointer to char to
pass to a native function call in a bit of managed c++ code like this:
Byte field __gc[] = dynamic_cast<Byte __gc[]>(record->get_Item(i));
..
..
..
Byte __pin * p = &field[0]; // << this is the proscribed way to pin a gc
array
char __nogc * pinfield = p; // << C2440 error here!
I get the following compilation error:
: error C2440: 'initializing' : cannot convert from 'unsigned char __pin
*volatile ' to 'char *'
Given that p is effectively a no-gc pointer to unsigned char, I can't
understand why I can't assign it to pinfield - a no-gc pointer to char (i.e.
exactly the same, just treat the chars as signed instead of unsigned).
Can anyone explain why I can't do this and how I can achieve what I'm trying
to please?
cheers
Tim
pass to a native function call in a bit of managed c++ code like this:
Byte field __gc[] = dynamic_cast<Byte __gc[]>(record->get_Item(i));
..
..
..
Byte __pin * p = &field[0]; // << this is the proscribed way to pin a gc
array
char __nogc * pinfield = p; // << C2440 error here!
I get the following compilation error:
: error C2440: 'initializing' : cannot convert from 'unsigned char __pin
*volatile ' to 'char *'
Given that p is effectively a no-gc pointer to unsigned char, I can't
understand why I can't assign it to pinfield - a no-gc pointer to char (i.e.
exactly the same, just treat the chars as signed instead of unsigned).
Can anyone explain why I can't do this and how I can achieve what I'm trying
to please?
cheers
Tim