DataType

# WString

<div class="rst-class">

forsearch

</div>

DataType

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

A 'wide' character string. This is primarily used with declares on Windows.

## Notes

You can assign a standard String to a <span class="title-ref">WString</span> and it will be converted and terminated automatically.

<span class="title-ref">WString</span> implicitly converts to String when assigned to a String variable.

On Windows, a wide character string means 2 bytes per character. The <span class="title-ref">WString</span> data type is typically used to map LPWSTR from OS API calls. To map LPWSTR, use ByRef <span class="title-ref">WString</span>.

On macOS and Linux, it means 4 bytes per character.

This means that a 12 byte <span class="title-ref">WString</span> on Windows can hold only 6 characters. On macOS and Linux it would hold only 3 characters.

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`Declare</api/language/declare>` statements

</div>
