C Standard Library

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

C Standard Library

Antony Vennard
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
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: C Standard Library

Douglas Gregor

On Dec 21, 2010, at 11:12 AM, Antony Vennard wrote:

> 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
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: C Standard Library

Antony Vennard
Hello,

On 21/12/10 19:19, Douglas Gregor wrote:

>
> On Dec 21, 2010, at 11:12 AM, Antony Vennard wrote:
>
>> 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

> This is the right place for this question.
> - Doug
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: C Standard Library

Sebastian Redl
In reply to this post by Antony Vennard

On 21.12.2010, at 20:12, Antony Vennard wrote:

> 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.

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
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: C Standard Library

Sebastian Redl
In reply to this post by Antony Vennard

On 21.12.2010, at 20:41, Antony Vennard wrote:

> Hello,
>
> On 21/12/10 19:19, Douglas Gregor wrote:
>>
>> On Dec 21, 2010, at 11:12 AM, Antony Vennard wrote:
>>
>>> 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 believe passing -ms-extensions pre-defines various macros that MSVC defines.

Sebastian
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: C Standard Library

Antony Vennard
On 21/12/10 19:49, Sebastian Redl wrote:

>>
>> 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 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
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: C Standard Library

Richard Pennington
In reply to this post by Antony Vennard
On 12/21/2010 01:12 PM, Antony Vennard wrote:

> 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

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
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: C Standard Library

Antony Vennard


On 21/12/10 21:04, Richard Pennington wrote:

> On 12/21/2010 01:12 PM, Antony Vennard wrote:
>> 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
>
> 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
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: C Standard Library

Michael Price - Dev
> 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.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: C Standard Library

Francois Pichet


On Tue, Dec 21, 2010 at 8:40 PM, Michael Price - Dev <[hidden email]> wrote:
> 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. 


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev