This question may actually belong in .learn.

What's exactly eliminated from the header generated with -H? I tried it just now and was surprised to see that the generated .di file includes the function bodies of regular (non-template) functions and methods.

I was under the impression that generated headers exclude function bodies, and found documentation to support that viewpoint:

http://www.digitalmars.com/d/2.0/dmd-windows.html#interface_files

says:

============
A D interface file contains only what an import of the module needs, rather than the whole implementation of that module.

The advantages of using a D interface file for imports rather than a D source file are:

* D interface files are often significantly smaller and much faster to process than the corresponding D source file. * They can be used to hide the source code, for example, one can ship an object code library along with D interface files rather than the complete source code.
============

This strongly suggests that function bodies are eliminated. But what I'm seeing is that pretty much all function bodies are kept (exception: static this() functions are not), and only comments are removed.

So what's -H really doing?


Andrei

Reply via email to