Feoramund
1.3K posts

Feoramund
@Feoramund
Archiver, programmer, sculptor.




It depends on what you mean by Linux; the joke about "GNU/Linux" holds some truth to it. To give a clear idea of where I am: I've built a standard library from nothing more than C89 code, syscalls, and x86 assembly that runs on Linux and FreeBSD, and I experimented with the Win32 API for several hours on a Windows 98 virtual machine back in March; I have far more experience working directly with the Linux kernel. Linux is barebones in what it can do, and significant chunks of the OS are scattered across a handful of C libraries, usually with a couple different options. So, if you're determined to write your own C standard library with no dependencies but the actual kernel, you have to write a lot from scratch. For instance, if you want to know the local timezone, you have to write a TZif parser from scratch; there is no syscall in Linux to get that information. If you want to resolve an internet domain name address, you have to write a DNS client and resolv-conf parser; there is no syscall in Linux to get that information. I've done both of these and more. In that view, Win32 is easier because I have seen significant upsides to using their C libraries against the idea of trying to write syscalls on Windows. Win32 provides everything in a consistent interface, and it has compatibility in mind; there's a good chance that a program made for Windows 98 can still run on a Windows machine of today. The same is hard to say for GNU/Linux in terms of binary reliability over time. If Linux had syscalls for everything: windowing, graphics, audio, DNS, datetime, and so on, it would be easier.







Wine can help build C code on Linux that uses the Win32 API. You get ELF programs that talk to Wine directly, and it's easy to setup. You can even get DirectX running. The second picture is showing the OpenWatcom Direct3D9 example code from the year 2004 with no modifications.





@valigo All I had to do was run "winemaker .", add "d3d9" to the list of DLLs in the makefile that it generated, and run make. This could truly be an alternative to SDL.









