toCStringThen

Copy the content of src into a C-string ('\0' terminated) then call dg

The intent of this function is to provide an allocation-less way to call a C function using a D slice. The function internally allocates a buffer if needed, but frees it on exit.

Note: The argument to dg is scope. To keep the data around after dg exits, one has to copy it.

nothrow
toCStringThen
(
alias dg
)
(
const(char)[] src
)

Parameters

src
Type: const(char)[]

Slice to use to call the C function

dg

Delegate to call afterwards

Return Value

Type: auto

The return value of T

Meta