stackalloc and PInvoke

  • Thread starter Thread starter Arsa
  • Start date Start date
A

Arsa

Hi,
I am using dllimport to invoke a function that takes a (byte*) as parameter:
void GetBuffer(byte* outBuff).
When I create a pointer in c# using fixed statement there is no problem
passing it as parameter, it works well. But when I create a pointer to a
stack memory using "stackalloc" statement I get a "NotSupportedException".
Anyone knows the reason?

Arsa
 
"stackalloc" throws a "NotSupportedException" because it's not supported in
the Compact Framework.
In general a managed "byte[]" would be best for a general-purpose data
buffer.

--------------------
From: "Arsa" <[email protected]>
Subject: stackalloc and PInvoke
Date: Fri, 16 Apr 2004 10:51:35 +0200

Hi,
I am using dllimport to invoke a function that takes a (byte*) as parameter:
void GetBuffer(byte* outBuff).
When I create a pointer in c# using fixed statement there is no problem
passing it as parameter, it works well. But when I create a pointer to a
stack memory using "stackalloc" statement I get a "NotSupportedException".
Anyone knows the reason?

Arsa

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top