Question

I am extracting code designed for an embedded system that uses math functions from NEWLIB and I would like to compile that code with Visual C++ Express Edition. However, it seems that part of the code inside NEWLIB is designed to be compiled only with GCC.

Question: Can NEWLIB be somehow modified to be compiled with a compiler other than GCC? How?

Am I asking unreasonable things here?

As an example, the following symbols are not understood by the Visual Compiler:

__extension__
__ULong
_mbtowc_state
__attribute__

Note, I would content myself if I could compile with LCC. Would this be easier?

Was it helpful?

Solution

Building newlib with MSVC would take a large porting effort. You are better off porting your code to the libc provided by MSVC. They should be mostly compatible. Simply remove newlib from you build system, MSVC will automatically link you code against it's own libc.

If you can built your code under MSVC you've probably already ported it to MSVC's libc anyway. Unless you are explicitly including headers from newlib. For example, if you include stdio.h, by default it will pickup MSVC's version unless you override this behavior to get it to use newlib's version.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top