Porting my very simple C code from Unixen/macOS to Windows

This page summarizes the projects mentioned and recommended in the original post on /r/C_Programming

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • RetroBASIC

    BASIC interpreter in lex/yacc/c

  • I have a very simple C console-based program based on flex/bison/c. It uses only standard libraries and has no external dependencies. It compiles on macOS using Xcode or a simple makefile, and appears to work fine on Linux using the same makefile.

  • getopt

    POSIX getopt() as a portable header library (by skeeto)

  • Between -std=c99 and removing these headers, you're missing time definitions (struct timeval, gettimeofday) and option parsing definitions (struct option, getopt_long). Mingw-w64 provides all this for compatibility, but MSVC has none of these, so you'll need to write replacements. I've written embeddable, public domain implementations of getopt and something like getopt_long, in case that helps. These are how I deal with option parsing portability.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • optparse

    Portable, reentrant, getopt-like option parser

  • Between -std=c99 and removing these headers, you're missing time definitions (struct timeval, gettimeofday) and option parsing definitions (struct option, getopt_long). Mingw-w64 provides all this for compatibility, but MSVC has none of these, so you'll need to write replacements. I've written embeddable, public domain implementations of getopt and something like getopt_long, in case that helps. These are how I deal with option parsing portability.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts