April 22, 2014 Re: Package permission and symbol resolution | ||||
---|---|---|---|---|
| ||||
On 22 April 2014 18:07, Manu <turkeyman@gmail.com> wrote: > So I've restructured one of my projects which is a C library bindings, but also with some D-ification. > > I separated it into 2 parts, the raw binding parts, and the api enhancements, the module structure looks like this: > > The Raw C binding part: > > pkg/c/module.d: > > pkg.c.module; Should read: module pkg.c.module; > struct ModuleStruct > { > package: > int privateParts; > } > > extern (C) void func(const(char)* pString); > > > And the wrapping layer; public import's the raw C bindings, which is meant to make the C API available too while adding some sugar for convenience. > > pkg/module.d: > > pkg.module; And: module pkg.module; > public import pkg.c.module; > > void func(const(char)[] str) > { > pkg.c.module.func(str.toStringz); > } > > void func2(ref ModuleStruct s) > { > s.privateParts += 10; > } |
Copyright © 1999-2021 by the D Language Foundation