Null Pointer Semantics

Most native string implementations use null pointer semantics, which means that they differentiate between empty strings (pointers to "") and null strings (null pointers).

To write wrapper functions for external functions in BDL that have optional string parameters, null pointer semantics are also implemented for BDL strings.

Example

dll "some.dll"
  "ApiFunc"
    function ApiFunc(in dstring optional);

dclfunc
  function ApiFuncWrapper(theString : string optional)
  begin
    ApiFunc(theString);
  end T1;

dcltrans
  transaction TMain
  begin
    ApiFuncWrapper();
  end TMain;

In cases where the optional parameter is omitted, external functions expect a NULL as the optional dstring parameter. Also if a string variable is set to NULLusing the StrSetNull() function, external functions expect NULL rather than DSTRING objects.

Note:
  1. A BDL string can explicitly be set to null: StrSetNull(str)
  2. Declared strings are always initialized to "". StrIsNull() returns false for declared strings, except when StrSetNull has been applied to them.
  3. An optional formal parameter may be a temporary object, as in the example above. In such cases StrIsNull(theString) returns true.