[cfe-dev] Compiling a simple Win32 program

Kim Gräsman kim.grasman at gmail.com
Fri Jun 8 00:33:34 PDT 2012


Hi Nikola,

On Thu, Jun 7, 2012 at 5:50 PM, Nikola Smiljanic <popizdeh at gmail.com> wrote:
>
>> You should check & use target arch.
>>
>
> What I have now kinda works. But the problem is that I'm not interested in
> Clang's default triple, I'm interested if the OS is 32bit or 64bit.

I'm not sure what the default triple represents, but there seems to be
four cases;

1) OS architecture is 32-bit, target is 32-bit -- use VC\bin
2) OS architecture is 64-bit, target is 32-bit -- use VC\bin
(Virtualization should allow the 32-bit linker to run and generate
32-bit code)
3) OS architecture is 32-bit, target is 64-bit -- use VC\bin\x86_amd64
4) OS architecture is 64-bit, target is 64-bit -- use VC\bin\amd64

Your if-chain looks right to me, if getDefaultTargetTriple() returns
architecture information that matches the OS.

> So if I
> have a 32bit Clang running on my Windows x64 and I'm targeting x64, it will
> use a cross tools which is wrong! How can I detect this?

It should work, though, thanks to 32-bit virtualization, right?

- Kim



More information about the cfe-dev mailing list