https://issues.dlang.org/show_bug.cgi?id=18031

Jonathan M Davis <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |[email protected]
                   |                            |m
         Resolution|---                         |INVALID

--- Comment #1 from Jonathan M Davis <[email protected]> ---
It's perfectly legal to declare functions without bodies. That's what you would
typically do in a .di file. The actual function body would then be in the
corresponding .d file. Most of the time, there's no reason to bother with .di
files, but in order for them to work, it's required that any function that does
not absolutely need its body to be present be able to not have its body present
(stuff like auto return functions and templated functions require their bodies,
but a normal function doesn't). Similarly, in some cases, the body may be in a
separate library entirely (though that's pretty much only with extern(C)
functions where the D declaration is just so that the D code can use an
existing C function).

You'll get a linker error as soon as you try to use the function if a function
body hasn't been linked in.

--

Reply via email to