Rust functions that return allocated strings

Returning an allocated string via FFI is complicated for the same
reason that returning an object is: the Rust allocator can
be different from the allocator on the other side of the FFI
boundary. It also has the same restrictions dealing with
NUL-terminated strings as passing a string argument.

Here we use a pair of methods into_raw and
from_raw. These convert a CString into a raw pointer
that may be passed across the FFI boundary. Ownership of the string is
transferred to the caller, but the caller must return the string to
Rust in order to properly deallocate the memory.

We follow a similar pattern to the object example: the Rust string is
contained within a subclass of SafeHandle and a wrapper class
ThemeSong ensures that the handle is disposed properly.

Unfortunately, there is no easy way to read the pointer as a UTF-8
string. C# has cases for ANSI strings and for “Unicode” strings
(really UCS-2), but nothing for UTF-8. We need to write that
ourselves.

We use the Cstring data type to represent a NUL-terminated string.
Rather than holding the allocated string in Julia space, this example
constructs a copy of the string with unsafe_string, to be managed
by Julia, and transfers the Rust string back afterwards. The
objects section provides an example where the
resource is kept alive in Julia.