Clang, Windows and stdout.

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

Clang, Windows and stdout.

David Blaikie via cfe-dev
 Hello. 

I am using MSElang, a Pascal compiler that produces bc (bit-code) files ready 
to use/compile with clang. 
https://gitlab.com/mseide-msegui/mselang

Here video of MSElang + Clang at work: 
mselang_exec.mp4 
<http://clang-developers.42468.n3.nabble.com/file/t497746/mselang_exec.mp4 

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

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 
-std=stdc   
-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. 

Thanks. 

Fre;D


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Clang, Windows and stdout.

David Blaikie via cfe-dev
On 1/17/2019 8:54 AM, Fred van Stappen via cfe-dev wrote:
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 
-std=stdc   
-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'


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; }


-Eli

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev