cross compiling linux -> windows

David Nadlinger via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Wed Mar 22 08:33:07 PDT 2017


On Wednesday, 22 March 2017 at 14:03:01 UTC, Oleg B wrote:
> Thanks, it works and now I get .obj output. ldc not support 
> cross linking and I must use external tools for this?

Well, in theory LDC doesn't care what linker it uses, so it 
supports cross-toolchains just fine.

No matter how your (cross-)compiler is implemented, to create 
executables (or shared libraries) for a given target you will 
need the appropriate C runtime and so on to link against. In our 
case, this is taken care of by a (g)cc-compatible linker driver 
resp. link.exe for Windows. LDC doesn't rely on these "external 
tools" for cross-compilation any more than for creating native 
executables.

Of course, in the case of Linux -> Windows, getting an equivalent 
link.exe in a Linux environment might be a bit challenging 
without resorting to tricks like linking in a VM. MinGW-w64 would 
be much easier to get working in this scenario.

  - David


More information about the digitalmars-d-ldc mailing list