[Mono-dev] "safe" way about Marshal.UnsafeAddrOfPinnedArrayElement

Sebastien Pouliot sebastien.pouliot at gmail.com
Tue Apr 18 08:38:37 EDT 2006


On Tue, 2006-04-18 at 12:27 +0800, GaoXianchao wrote:
> hi all,
> I'm wrapping epoll api on linux.
> To pass address of managed struct array to unmanaged code, I use
> Marshal.UnsafeAddrOfPinnedArrayElement . But the method is "unsafe".
> Is there a "safe" way to do what the Marshal.UnsafeAddrOfPinnedArrayElement do?

Safe and unsafe are used for different meanings between languages (e.g.
C#) and the framework base class library.

In this case, like many times it's used in the FX BCL, the Unsafe prefix
means that special security requirements for this method makes it
dangerous to use with non fully-trusted code (see MSDN documentation for
more details).

So unless you are using "mono --security" to activate the (partial and
unsupported) security manager this *doesn't* affect you at all (as all
your code is *always* executed under FullTrust).

Sebastien Pouliot  <sebastien at ximian.com>
Blog: http://pages.infinit.net/ctech/

More information about the Mono-devel-list mailing list