How do I create a package?

Mike Parker aldacron at gmail.com
Wed Mar 2 17:55:48 UTC 2022


On Wednesday, 2 March 2022 at 16:38:58 UTC, M wrote:
> There doesn't seem to be any docs on how to actually create 
> packages.
>
> Is there a description anywhere?

In case you're talking about a language-level package and not a 
dub package, just create a directory in your source tree with the 
name of your package, stick your source files in it and add a 
module statement to the top of each source file like so:


```d
module packagename.modulename;
```

For subpackages, add subdirectories and throw those names into 
the module statement:

```d
module packagename.subpackagename.modulename;
```


More information about the Digitalmars-d-learn mailing list