CWrap

Struct that provides following things:

1. RAII wrapper above handle type 2. Mechanism that strips prefix from names of functions in given module. Those functions are available through opDispatch-based mechanism.

Constructors

this
this()
Undocumented in source.
this
this(typeof(this) )
Undocumented in source.
this
this(Parameters!constructor args)
Undocumented in source.

Destructor

~this
~this()
Undocumented in source.

Alias This

handle

Members

Templates

opDispatch
template opDispatch(string f)
Undocumented in source.

Variables

handle
ReturnType!constructor handle;
Undocumented in source.

Parameters

module_

module with functions from which given prefix should be stripped

prefix

prefix that should be stripped from names of functions

constructor

a function that creates a handle. Note: constructor must take at least one non-optional argument

destructor

function that gets called when struct gets destroyed. Mustn't take any arguments

Examples

import etc.c.curl;
alias Curl = CWrap!(etc.c.curl, "curl_easy_", (int _) => curl_easy_init(), curl_easy_cleanup);
auto c = Curl(0);
c.setopt(CurlOption.url, "https://dlang.org");
c.perform();

Meta