compat.libpng
#includePNG reference library — portable PNG encode/decode (depends on zlib)
#include "png.h"
mcpp add compat.libpng@1.6.59
Usage
From this repository's own test project — built and run by CI, not written for the website.
// Smoke test — verify compat.libpng builds, links, and basic API works
#include "png.h"
import std;
int main() {
auto* png = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
if (!png) return 1;
auto* info = png_create_info_struct(png);
if (!info) { png_destroy_read_struct(&png, nullptr, nullptr); return 2; }
std::println("compat.libpng smoke test: ok");
png_destroy_read_struct(&png, &info, nullptr);
return 0;
}
tests/examples/libpng/tests/read.cpp · project tests/examples/libpng
openkal
| target | result | environment | test project | first diagnostic |
|---|---|---|---|---|
| x86_64-linux-gnu | runs | posix | libpng | |
| x86_64-windows-musl | runs | posix | libpng |
How this was measured
Measured 2026-09-23 by tests/openkal/compat.py with openkal-llvm-runtime 0.15.1, llvm@22.1.8, mcpp 2026.9.21.3. The test project selects no platform dependency of its own. The badge above is a summary of the strictest measured target -- the table above states each target's own environment.
Build
- targets
libpng (lib)- language
c++23- C standard
c99- import std
- no
- include dirs
*, mcpp_generated
Sources (15)
*/png.c*/pngerror.c*/pngget.c*/pngmem.c*/pngpread.c*/pngread.c*/pngrio.c*/pngrtran.c*/pngrutil.c*/pngset.c*/pngtrans.c*/pngwio.c*/pngwrite.c*/pngwtran.c*/pngwutil.c
Generated files
mcpp_generated/pnglibconf.h