www.digitalmars.com         C & C++   DMDScript  

D - Packages in D

reply "Tu Nam" <dreamweaver mail15.com> writes:
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 .
Apr 24 2004
parent "Vathix" <vathix dprogramming.com> writes:
"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

 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

 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
Apr 23 2004