Function prototype + definition in the same file

Jonathan M Davis jmdavisProg at gmx.com
Tue Sep 25 09:38:20 PDT 2012


On Tuesday, September 25, 2012 14:53:17 Manu wrote:
> I really need this. Why is it illegal? Is there chance of having this
> supported? What are the problems?

I confess that I don't understand why you'd ever need function prototypes, so 
clearly one (or both) of us is missing something here.

If you you've defined the function, it's there, and that should provide dynamic 
linkage just fine. The only cases that I can think of where the function 
_wouldn't_ be defined in spite of actually be in the source file are when it's 
in a version block or static if which isn't compiled in (in which case, it's 
not _supposed_ to exist) or if it's a template, in which case, AFAIK, it's 
_never_ dynamically linkable, but rather it's instantiated in the code which 
uses the library when it uses that templated function.

So, what am I missing here?

- Jonathan M Davis


More information about the Digitalmars-d mailing list