Current Help System: PC-DMIS BASIC (View Core Help)

### Passing and Returning Strings

Cypress Enable maintains variable-length strings internally as BSTRs. BSTRs are defined in the OLE header files as OLECHAR FAR *. An OLECHAR is a UNICODE character in 32-bit OLE and an ANSI character in 16-bit OLE. A BSTR can contain NULL values because a length is also maintained with the BSTR. BSTRs are also NULL terminated so they can be treated as an LPSTR. Currently this length is stored immediately prior to the string. This may change in the future, however, so you should use the OLE APIs to access the string length.

You can pass a string from Cypress Enable to a DLL in one of two ways. You can pass it "by value" (ByVal) or "by reference". When you pass a string ByVal, Cypress Enable passes a pointer to the beginning of the string data (i.e. it passes a BSTR). When a string is passed byreference, Enable passes a pointer to a pointer to the string data (i.e. it passes a BSTR *).

OLE API

SysAllocString/SysAllocStringLen

SysAllocString/SysAllocStringLen

SysFreeString

SysStringLen

SysReAllocStringLen

SysReAllocString

Note:: The BSTR is a pointer to the string, so you don't need to dereference it.