How to create a function declaration?

Marcio Faustino m.faustino at gmail.com
Fri Jan 12 08:44:06 PST 2007


Hi everyone,

How can I create a function declaration only and provide its definition later?
For example:

/******************************************************************************/
extern (C) int print(char*);

extern (C) int print(char* s) {
    return printf("%s", s);
}

void main() {
    print(cast(char*) "test\0");
}
/******************************************************************************/

The compiler says:
«test.d(9): function test.print called with argument types:
        (char*)
matches both:
        test.print(char*)
and:
        test.print(char*)»

What am I doing wrong?
Thanks,


More information about the Digitalmars-d-learn mailing list