Passing D arrays to a C interface

David Brown dlang at davidb.org
Mon Nov 5 09:26:05 PST 2007


On Mon, Nov 05, 2007 at 10:13:22AM +0100, torhu wrote:

> D dynamic arrays are not (portably) link-compatible with anything in C.  
> Most of the time you would get away with pretending they are a 'struct 
> dynarray { size_t len; void* data; };'  But it's probably better to pass 
> the size and the pointer separately, like in the example.

Especially best to not use this, since Walter seems to be thinking of
changing this representation.

Dave



More information about the Digitalmars-d mailing list