digitalmars.D.learn - idiom for C error strings
- yawniek (5/5) Jul 21 2015 whats the proper way to use/wrap C functions that expect a error
- Daniel =?UTF-8?B?S296w6Fr?= (10/16) Jul 21 2015 dynamic:
- Adam D. Ruppe (3/5) Jul 21 2015 somefun(param1, buf.ptr, buf.length);
whats the proper way to use/wrap C functions that expect a error string buffer e.g.: somefun(T param1, char* errstr, size_t errstr_size) in D ?
Jul 21 2015
On Tue, 21 Jul 2015 12:27:55 +0000 "yawniek" <dlang srtnwz.com> wrote:whats the proper way to use/wrap C functions that expect a error string buffer e.g.: somefun(T param1, char* errstr, size_t errstr_size) in D ?dynamic: auto buf = new char[size]; somefun(param1, buf.ptr, buf.length); or somefun(param1, buf.ptr, size); static: char[size] buf; somefun(param1, &buf, size);
Jul 21 2015
On Tuesday, 21 July 2015 at 12:40:37 UTC, Daniel Kozák wrote:static: char[size] buf;somefun(param1, buf.ptr, buf.length); still works there too. That's the form I prefer to use.
Jul 21 2015