- So, how many people here,
can I get a show of hands,
develop software that targets Windows?
All right, like how many people
that just raised their hand
also develop software that
does not target Windows?
Good, so hopefully that
you'll find this interesting.
Well first let's look at my direct.
Can you read the text, is it a good size?
Okay cool.
So you can see that I
only have a CPP file here
and a couple of shell scripts.
And I'm gonna look at this CPP
file, this is Windows code.
Hopefully we can all agree
that this is Windows code.
(audience laughs)
And, as you can see, I'm
not on a Windows machine,
I'm on, you know, it's Linux.
And so, I have this shell script here,
which you can see, runs
clang-cl and lld-link.
And I'm just gonna run this shell script.
See if I can do this.
Okay, it did something.
So okay, you can see now there's
an EXE file and a OBJ file
and a PDB file.
Which are usually Windows programs.
And if I run this command
to see what they are,
it says that, well first of all,
it says that clang-cl and
lld-link are ELF executables.
So, there's no wine involved
here, there's no like trickery.
These are native Linux programs.
And the files that it
produced, a PE32+ executable,
a COFF object file, and
a MSVC program database.
And I also conveniently printed
out md5sums of the files.
Which we can try to remember,
I don't know 82FD, F0F3.
(audience laughs)
So, I'm gonna go over here
to my Windows machine,
this is actually my home machine.
I'm connected through a remote desktop.
We can see code that looks
pretty much the same.
But let's make sure that we're actually
doing the same thing, this
one might be a little smaller.
Hopefully we can still see this, but.
So I don't know if you can see
this or not but the md5sum,
it says 82fdb8 whatever
it's the same md5sum.
And we'll see the same thing
if I do it on the PDB F0F3,
like that's what we just said.
So, I kinda just cheated here
because I built the program
on Linux, but I didn't
copy the files over.
But I don't know if anybody noticed that
I kinda pulled a fast one here.
I just demonstrated that
we have build determinism.
Because these files were already
here, and I just built it.
And they have the same md5sum.
That's, I don't know, I
think it's a good feature.
I'm gonna hit F5 and see what
happens, well first let's see.
Okay, I have a break
point, so I'm gonna hit F5.
Or maybe I'm not.
I don't know what that's
saying, all right,
let's try it a different way.
Start debugging.
Oh, nice.
Ooh, this is going well.
(audience laughs)
Okay, here we go.
So, I don't know if you can see this,
but we have like Local Variables,
we have Watch Window and stuff,
there's real stuff in here.
You know I can step over,
I can do everything.
So, this is like, it's
a real Windows program,
it's got a real PDB file.
And, I built this on Linux.
And I can debug it in Visual Studio.
This is something that until
recently has not been possible.
That's one of the the
things we worked hard on,
is making Clang work on Windows,
well work cross-platforming,
we can do cross-builds.
But, there's other reasons
that you might wanna use Clang.
We get faster link times, if you use LLD.
When I mean faster, I mean like,
a literal order of magnitude faster.
Like I know, when we built,
we built this for Chrome.
And Chrome was originally
taking up to five minutes
to link, like blink Core dot yellow.
With LLD it takes about 30 seconds.
Using the same switches.
Clang-cl it's drop-in
compatible with cl.exe.
So, if you look at my, if
you look at my build script.
You can see I'm running
clang-cl but these are MSVC
command line options.
/Z7, /c, my ld-link
command line looks exactly
like a link.exe command line.
/Debug:Full, DefaultLib,
Subsystem:Windows.
So this is literally, you
can just drop the executable
on your machine and it just works.
Why did we do this?
Like I mentioned, faster link times,
it's nice to have one tool
chain on all your platforms,
one build system.
Simplifies configuration
management, and it's open source.
We can turn around and we can
make changes to the compiler,
in a week, where it used to take a year.
I mean, obviously
Microsoft has gotten better
about releasing fixes more rapidly now
but it used to take a year
or two to get compiler fixes,
and now we can turn that
around in like a week.
Real world users of Clang and LLD,
obviously Chrome, it's shipping.
Like if you're using Chrome
today it's built with Clang
and it's linked with LLD.
Firefox is shipping with.
(clapping)
(audience laughs)
Am I done?
- Oh yeah!
- Aw!
