←back to thread

228 points Retro_Dev | 1 comments | | HN request time: 0s | source
Show context
90s_dev ◴[] No.44464923[source]
I don't mind breaking changes if I can fix them within a day.

What bothers me with C/C++ is how difficult it is to cross compile a simple Windows + SDL app from inside WSL without MSVC installed.

I've spent weeks on this.

If Zig saves me from that nightmare, and still lets me use C++ libraries, I will gladly switch over to it.

replies(3): >>44464991 #>>44465628 #>>44472217 #
flohofwoe ◴[] No.44464991[source]
You'll have to write C API wrappers around your C++ libraries to access them from Zig, but other then that I can cross-compile my mixed C/C++/Zig projects using Windows APIs like DXGI/D3D/WASAPI with `zig build -Dtarget=x86_64-windows` from a Mac with the vanilla Zig toolchain.

...you don't even need to port anything in your C/C++ project to Zig, just integrate `zig cc` as C/C++ compiler into your existing build system, or port your build system files to build.zig.

replies(2): >>44465041 #>>44465199 #
1. 90s_dev ◴[] No.44465041[source]
That works out great, since all the libraries I need are C or have C wrappers anyway. I might actually do this, thanks.