www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Module imports

reply zengar <zengar_member pathlink.com> writes:
Hello everyone,
I would like to know how compiled modules actually work in D. The object files
usually store only implementation, but not the interface part. How is the
interface information being retreaved when a module gets imported? Does the
compiler need the source code of that module to parse the inteface data from it?
The phobos library seems to work fine even without the source code. Or do the
compiled object files get some sort of "manifests"?

Thanks!
Nov 08 2005
parent David Medlock <noone nowhere.com> writes:
They serve dual roles in D as interface, implementation and both.

The D compiler must have a source file when you import.  You can write a 
'stripped' D file which only has the interface, which when compiled 
using the obj/o file from your 'full' version of the D file will produce 
an executable.  Of course the 'full' version of the source file will 
work in all cases.

-DavidM

zengar wrote:
 Hello everyone,
 I would like to know how compiled modules actually work in D. The object files
 usually store only implementation, but not the interface part. How is the
 interface information being retreaved when a module gets imported? Does the
 compiler need the source code of that module to parse the inteface data from
it?
 The phobos library seems to work fine even without the source code. Or do the
 compiled object files get some sort of "manifests"?
 
 Thanks!
 
 
Nov 08 2005