Pelles C forum

Pelles C forum => General discussion => Topic started by: TimoVJL on October 20, 2026, 05:04:34 PM

Title: Testing code with other C compilers
Post by: TimoVJL on October 20, 2026, 05:04:34 PM
If program code avoid crt, it might be easy to compile it with different compilers.
I use clang-cl.exe as a reference C compiler to see more warnings, but some projects was quite easy to build with clang and with polink with Pelles C libraries.
With clang i saw many unused variables and dead code.
Title: Re: Testing code with other C compilers
Post by: Vortex on October 20, 2026, 08:18:54 PM
Hi Timo,

Pelles C can detect unused variables too. I guess you found a specific case. Could you share your code if it's possible?
Title: Re: Testing code with other C compilers
Post by: TimoVJL on October 20, 2026, 09:18:46 PM
I like to test codes for compability reasons.

TLPeViewUC.c had some cases, like
int i;
...
i  = 0;
and it wasn't used later and was a testing leftover.

char *pName = 0;
...
pName = (char*)pImportBName->Name;


EDIT 2026-10-22: A TLWHView needed a lot of changes to sources and headers for making it compilable with Clang with only using Pelles C Windows headers and libraries and msvcrt.dll
Title: Re: Testing code with other C compilers
Post by: Vortex on November 01, 2026, 11:43:53 AM
Hi Timo,

I think you can use only clang.exe to compile code without depending on the other Clang binaries :

C:\clang>clang -c -m32 -Wall Hello.c -o Hello32.o


C:\clang>set INCLUDE=D:\VCForPython27\VC\include;D:\VCForPython27\WinSDK\Include


C:\clang>clang -c -m32 -Wall Hello.c -o Hello32.o
Title: Re: Testing code with other C compilers
Post by: TimoVJL on November 01, 2026, 12:38:24 PM
Those headers makes things easier.

clang-cl.exe don't accept WINSDK annotations and also problems with standard headers.

VCForPython27.msi is still available too.

clang.exe hello.c -Wl,-nodefaultlib:libcmt -D_DLL -lmsvcrt -o hello_clang64.exe
Title: Re: Testing code with other C compilers
Post by: Michele on November 01, 2026, 01:34:46 PM
I use Eclipse IDE for all projects, from windows to embedded hardware.
I use clang to compile windows apps.
Isn't perfect, but is very helpful on writing, compiling and testing.