3

I am on Windows and I have Visual Studio installed and the latest version of clang. I am able to run:

clang-cl hello.c

Which in turn generates hello.exe, which I can run as expected.

But what I want to do is to generate a static library instead (.lib file). I am able to pass the /LD flag to generate a dynamic link library but I can't figure out how to generate a static library instead.

Is this possible to do with clang-cl?

justin.m.chase
  • 13,061
  • 8
  • 52
  • 100

2 Answers2

3

Yes, it seems to be possible.

Use -fuse-ld=llvm-lib to link multiple source files into a static library

Temtaime
  • 46
  • 2
1

It looks like the answer is to use llvm-lib. This threw me off a bit because it wasn't named clang-lib but it appears to be doing what I am expecting.

justin.m.chase
  • 13,061
  • 8
  • 52
  • 100