Discussion:
Marshal
(too old to reply)
xcal
2009-08-31 23:46:33 UTC
Permalink
Hi group,

I'm curious,
with C#, MarshalAs can give you the unmanaged representation of any basic
unmanaged Windows type?, I mean for "basic type", not a "structure type".

thanks very much in advance, Carlos.
Kevin Westhead
2009-09-18 17:44:13 UTC
Permalink
Post by xcal
Hi group,
I'm curious,
with C#, MarshalAs can give you the unmanaged representation of any basic
unmanaged Windows type?, I mean for "basic type", not a "structure type".
thanks very much in advance, Carlos.
The MarshalAs attribute allows you to explicitly specify how data is
transferred between managed and unmanaged code. You only really need it for
data types that support multiple representations. For example, managed
strings are marshaled to COM as UnmanagedType.BStr and to p/invoke as
UnmanagedType.LPTStr by default. If you have a p/invoke signature with a
BSTR then you'll need to use the MarshalAs attribute to override the default
behaviour for managed strings.

Have a look at http://msdn.microsoft.com/en-us/library/zah6xy75.aspx for
more information.
--
Kevin Westhead
Continue reading on narkive:
Loading...