NETLink`
NETLink`

MarshalStringsAs

MarshalStringsAs

is an option to DefineDLLFunction that specifies how string arguments should be marshaled into the DLL function. This applies to any arguments that are mapped to the System.String class, which includes types specified in your declaration as "char*", "string", or "ByVal As String".

Details and Options

  • To use MarshalStringsAs, you first need to load .NET/Link using Needs["NETLink`"].
  • Possible values are:
  • "ANSI"strings will be sent as single-byte C-style strings (default)
    "Unicode"strings will be sent as 2-byte Unicode strings
    Automaticstrings will be sent in the platform's default format
  • The Automatic setting picks the platform default ("Unicode" on Windows NT/2000/XP, "ANSI" on 98/ME). Automatic should rarely be used, as it is intended mainly for certain Windows API functions that automatically switch behaviors on different versions of Windows.