writing pure C program with dmd / linking error

Sean Kelly sean at f4.ca
Sun Mar 11 10:52:33 PDT 2007


Matthias Walter wrote:
> I'm trying to write a pure C program with D, like:
> 
> extern (C) {
> 
> int main(int argc, char **argv) {
>         return 1;
> }
> 
> }
> 
> I did:
> dmd -c test.d
> gcc -o test test.o
> 
> the linker complains: 
> test.o: In function `gcc2_compiled.':
> test.d:(.text+0x8): undefined reference to `_Dmodule_ref'

I think any D app at least requires a valid D entry point:

int main(char[][] args ); (no extern (C))

The rest can all be C, though, if you'd like.


More information about the Digitalmars-d-learn mailing list