doc. inconsistency: default p/invoke marshaling for strings

M

Mark

Below given several excerpts from msdn library documentation for default
p/invoke marshaling for strings. which of them says the truth? which one
should we depend on?
thanks

--- Default Marshaling for Strings
ms-help://MS.MSDNQTR.2003APR.1033/cpguide/html/cpcondefaultmarshalingforstri
ngs.htm

Strings Used in Platform Invoke
UnmanagedType.BStr
(default)

--- MarshalAsAttribute Class
ms-help://MS.MSDNQTR.2003APR.1033/cpref/html/frlrfSystemRuntimeInteropServic
esMarshalAsAttributeClassTopic.htm

By default, the runtime marshals a string parameter (and fields in a value
type) as a LPStr to a platform invoke method or function. For additional
information, see Default Marshaling Behavior.

--- Platform Invoke Tutorial
ms-help://MS.MSDNQTR.2003APR.1033/csref/html/vcwlkPlatformInvokeTutorial.htm
#pinvoke_defaultmarshaling

For example, the default marshaling for C# string values is to the type
LPTSTR (pointer to TCHAR char buffer).
 
M

Mattias Sjögren

Below given several excerpts from msdn library documentation for default
p/invoke marshaling for strings. which of them says the truth?

In COM interfaces the default is BStr.

In DllImport methods the default is LPStr if you don't set the
CharSet.



Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top