January 10, 2009 linking with c | ||||
---|---|---|---|---|
| ||||
So I'm trying to link a C file to be used in a D program: hw.c: #include <stdio.h> void hw() { printf("Hello, world!"); } hw_main.d: module hw_main; extern (C) void hw(); int main() { hw(); return 0; } I compile the C file with dmc: dmc -c hw.c and the D file with dmd: dmd -c hw_main.d I try to link them with the digital mars linker: link hw.obj hw_main.obj bu it complains about phobos.lib. So I try: link hw.obj hw_main.obj (path)\phobos.lib and I get a bunch of "symbol undefined" errors. Any advice? |
January 10, 2009 Re: linking with c | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike | Mike wrote:
> So I'm trying to link a C file to be used in a D program:
> I compile the C file with dmc: dmc -c hw.c
> and the D file with dmd: dmd -c hw_main.d
I usually keep it simple and do: dmd main.d hw.obj
|
Copyright © 1999-2021 by the D Language Foundation