C Standard Library

Hi All,

I am aware of the libcxx project providing a standard library for C++
for use with clang. Is there an equivalent project for C? I guess I
could take headers like "cstdio" and rename them to "stdio.h" but I
didn't think that would necessarily be the right approach.

The reason I ask is that I have built clang/llvm (2.8) for Win64 and am
looking for the remaining parts to complete a C/C++ development
environment. I have a half-finished NSIS install script (happy to donate
it to the project) you see and I'd like to be able to package clang/llvm
for win64 distribution.

Not sure if this isn't better suited to llvm-users, so sorry if it is.

Thanks,

Antony

Hi All,

I am aware of the libcxx project providing a standard library for C++
for use with clang. Is there an equivalent project for C?

To my knowledge, there is no such project. Clang aims to work with the system C library on a variety of platforms.

I guess I
could take headers like "cstdio" and rename them to "stdio.h" but I
didn't think that would necessarily be the right approach.

No, that won't work; most <cstdio> implementations are just wrappers around <stdio.h>.

Not sure if this isn't better suited to llvm-users, so sorry if it is.

This is the right place for this question.
  - Doug

Hello,

Hi All,

I am aware of the libcxx project providing a standard library for C++
for use with clang. Is there an equivalent project for C?

To my knowledge, there is no such project. Clang aims to work with the system C library on a variety of platforms.

Ok, I've just tried what I was having problems with and understood it
this time (last time was after a build which took several hours):

#error: ERROR: Only Win32 target supported!

When trying to compile a simple hello world application with my just
built clang.

clang -o hello.exe -D_WIN32 hello.c fixes the problem.

Is there any way to build these automatic defines into clang? Or have I
done something wrong in compilation?

I'm building against the 2.8 SVN branches for both clang and llvm.

Antony

You could check MinGW if you can use a CRT (or at least development headers) from there. Not sure if they have their own CRT or use the MS one.

Sebastian

I believe passing -ms-extensions pre-defines various macros that MSVC defines.

Sebastian

To the build process for clang I assume? I used cmake with the nmake
files because the vs2010 64-bit generator is broken in cmake 2.8.3 (bug).

Antony

Antony,

Funny you should mention C libraries. I'm on vacation from my day job until January 4th. and have just begun to port the NetBSD standard library for use with Clang. I'm targeting Linux and embedded platforms, however, so I don't think it would be of much use under Windows.

I'm pretty sure MinGW just provides headers and uses the standard MS C runtime library, at least without MSYS. That would probably be a good place for you to start.

-Rich

Hello,

I did think about that actually. It might well be worth looking into
zipping those up too.

For the project I've got, we're happy using MS headers. However the
problem I'm currently having is that neither -fms-extensions or
-ms-extensions are changing the fact that _WIN32 remains undefined.

Antony

For the project I've got, we're happy using MS headers. However the
problem I'm currently having is that neither -fms-extensions or
-ms-extensions are changing the fact that _WIN32 remains undefined.

I'm not sure that VC++ actually defnes _WIN32 for you. If you look at the settings for .vcproj files, you'll see it defined at that level.

If nobody else knows, I can try to get around to running an experiment, or you could do so yourself.

Hi,

VC++ defines _WIN32 by default. clang was modified to define _WIN32 if the target is Visual Studio on October 21. Release 2.8 was done in September, as such _WIN32 is not defined using the 2.8 release.

Try using the trunk maybe, or define it yourself.