Hi Rob
"rob" <rm*******@yahoo.com> wrote in message
news:11**********************@j55g2000cwa.googlegr oups.com...
I have the following code:
int Function(short buffer __gc[]) {
....
short __pin* inPinned = & buffer[0];
DoSomethingUnsafe(inPinned)
...
}
&buffer[0] shows a valid address but when I pin it down inPinned is 0.
Why does this not work?
Thanks
Your observation is wrong. The code below dumps a valid address:
#using <mscorlib.dll>
#include <stdio.h>
#pragma unmanaged
void DoSomethingUnsafe(short* p)
{
printf("p = 0x%X", p);
}
#pragma managed
int main()
{
short buffer __gc[] = {1, 2, 3};
short __pin* inPinned = & buffer[0];
DoSomethingUnsafe(inPinned);
}
Marcus