April 24, 2004 Packages in D | ||||
---|---|---|---|---|
| ||||
I know that modules can be grouped together in heirarchies called packages .And modules corresponding to directory of sourcefiles. But D compile source to native code so if I want to make a packages or a lib which allows user "import mymodule" and don't need to release the source files , what steps will I do ? This is the thing I see in socket.d : extern(Windows) export int ioctlsocket( SOCKET s, int cmd, u_long *argp); but it is the interface to API of Windows , not a D lib . |
April 24, 2004 Re: Packages in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tu Nam | "Tu Nam" <dreamweaver@mail15.com> wrote in message news:c6d6bc$1m93$1@digitaldaemon.com... > I know that modules can be grouped together in heirarchies called packages .And modules corresponding to directory of sourcefiles. But D compile source > to native code so if I want to make a packages or a lib which allows user > "import mymodule" and don't need to release the source files , what steps > will I do ? > This is the thing I see in socket.d : > extern(Windows) export int ioctlsocket( SOCKET s, int cmd, u_long *argp); > but it is the interface to API of Windows , not a D lib . > - source mymodule.d - module mymodule; int foo() { return 2; } - stripped mymodule.d - module mymodule; int foo(); - Compile source and import stripped. You can't do it exactly like a C or Windows function because the module (and package) name is part of a D [function] name; D functions don't have a single, global namespace. They can have different filenames but the module statement needs to be the same. -- Christopher E. Miller |
Copyright © 1999-2021 by the D Language Foundation