How to create a function declaration?

Jarrett Billingsley kb3ctd2 at yahoo.com
Fri Jan 12 12:30:46 PST 2007


Marcio Faustino Wrote:

> Even so, the compiler says that
> "object.printf" conflicts with "my_printf.printf"... but where??

It's declared in two places, and so when you call "printf" in test.d, it finds two printfs.  It's a simple matter of symbol lookup -- one name in this case maps to more than one possible function.  So the conflict occurs at the call site, which can be fixed by using either an FQN or an alias, as mentioned.  

If you were linking against some C stdlib that didn't have an implementation of printf, the fix is very simple -- comment out the printf declaration in object.d.


More information about the Digitalmars-d-learn mailing list