Clang, Windows and stdout.


I am using MSElang, a Pascal compiler that produces bc (bit-code) files ready
to use/compile with clang.

Here video of MSElang + Clang at work:

On Linux 32 bit, MSElang works like charm, doing this:

$ clang my_pascal_llvm.bc -lm -o my_pascal_llvm

—> produces a beautiful my_pascal_llvm executable, fast and light.

Also the bc file is perfectly handled by opt that make a full-working
._opt.bc file.
That ._opt.bc file is perfectly handled too by clang and the executable is
perfectly running.

Big congratulation to LLVM (for that wonderful project) and to Martin (for

But for Windows, using this (I use thw wine emulator on Linux):

wine “/home/fred/.wine/drive_c/Program Files (x86)/LLVM/bin/clang.exe”
-L /home/fred/mlctest/ -I /home/fred/mlctest/include/ -O3 -v -lgcc_eh
-target i686-w64-mingw32 -dynamic -Wall -Wextra
/home/fred/mlctest/my_pascal_llvm.bc -lgcc_s
-lstdc++ -lstdc -lgcc -lgcc_eh -lobjc -lsupc++ -lgcov -liconv2 -lsspicli
-lwinpthread -lgdiplus -o /home/fred/mlctest/my_pascal_llvm.exe

There is that error (all other undefined references are fixed)

→ undefined reference to `stdout’

Do you have any idea why `stdout’ is not found?
IMHO it is in libgcc but for Windows it does not find it.

Any light will be very appreciated.



On Windows, there is no symbol named stdout; the C standard only requires a macro in stdio.h. You can use a small C wrapper like the following to get a reference:

#include <stdio.h>

FILE *getstdout() { return stdout; }