CString package:base

A C string is a reference to an array of C characters terminated by NUL.
A string with explicit length information in bytes instead of a terminating NUL (allowing NUL characters in the middle of the string).
Compute the length of a NUL-terminated string. This address must refer to immutable memory. GHC includes a built-in rule for constant folding when the argument is a statically-known literal. That is, a core-to-core pass reduces the expression cstringLength# "hello"# to the constant 5#.
Marshal a Haskell string into a NUL terminated C string.
  • the Haskell string may not contain any NUL characters
  • new storage is allocated for the C string and must be explicitly freed using free or finalizerFree.
Marshal a Haskell string into a C string (ie, character array) with explicit length information.
  • new storage is allocated for the C string and must be explicitly freed using free or finalizerFree.
Marshal a NUL terminated C string into a Haskell string.
Marshal a C string with explicit length into a Haskell string.
Marshal a Haskell string into a NUL terminated C string using temporary storage.
  • the Haskell string may not contain any NUL characters
  • the memory is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not be used after this.
Marshal a Haskell string into a C string (ie, character array) in temporary storage, with explicit length information.
  • the memory is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not be used after this.
Marshal a Haskell string into a NUL terminated C string.
  • the Haskell string may not contain any NUL characters
  • new storage is allocated for the C string and must be explicitly freed using free or finalizerFree.
Marshal a Haskell string into a C string (ie, character array) with explicit length information. Note that this does not NUL terminate the resulting string.
  • new storage is allocated for the C string and must be explicitly freed using free or finalizerFree.
Marshal a Haskell string into a NUL-terminated C string (ie, character array) with explicit length information.
  • new storage is allocated for the C string and must be explicitly freed using free or finalizerFree.
Marshal a NUL terminated C string into a Haskell string.
Marshal a C string with explicit length into a Haskell string.
Marshal a Haskell string into a NUL terminated C string using temporary storage.
  • the Haskell string may not contain any NUL characters
  • the memory is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not be used after this.
Marshal a Haskell string into a C string (ie, character array) in temporary storage, with explicit length information. Note that this does not NUL terminate the resulting string.
  • the memory is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not be used after this.
Marshal a Haskell string into a NUL-terminated C string (ie, character array) in temporary storage, with explicit length information.
  • the memory is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not be used after this.
Marshal a list of Haskell strings into an array of NUL terminated C strings using temporary storage.
  • the Haskell strings may not contain any NUL characters
  • the memory is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not be used after this.