Cross-Platform C Library Integration

概述

HotPDF 使用 HPDFCLibs.pas 作为 Delphi 与 HPDFZLib.pas、HPDFJpeg.pas 和 HPDFTiff.pas 所用静态链接 C object files 之间的 Pascal-facing bridge。该单元公开这些库需要的 runtime symbols,同时为 Win32 和 Win64 构建保持一致的 Pascal declaration layer

关键特性

  • 为 zlib-ng 的 zlib-compatible mode、zlib-ng 64-bit runtime SIMD dispatch、带 NASM SIMD objects 的 libjpeg-turbo 3.1.90,以及 libtiff 4.7.1 提供共享 runtime bridge
  • Memory, stdio, string/character, and selected math/runtime helper coverage
  • 32-byte aligned malloc, free, realloc, and calloc bridging for SIMD-friendly native buffers
  • 通过 Lib\thirdparty\Win32 中由 bcc32c 构建的 zlib-ng OMF objects,以及由 bcc32 构建的 JPEG/TIFF OMF objects 提供 Win32 兼容性
  • 通过 Lib\thirdparty\Win64 中的 COFF64 obj files,以及 Lib\thirdparty\Win64x 中的 zlib-ng COFF objects 提供 Win64 兼容性
  • 为 Delphi linker 无法直接导入的符号提供 pointer-sized helper types 和 Pascal stubs

High-Performance JPEG Backend

标准 JPEG 工作流通过 HPDFJpeg.pas 公开的 classic libjpeg-compatible API,由 libjpeg-turbo 3.1.90 支撑。Win32、Win64 和 Win64x object builds 包含相关 NASM SIMD acceleration objects,同一捆绑 object set 也可供 TIFF integration layer 处理 JPEG-compressed TIFF

Zlib-ng Bridge Notes

Win64 Flate image streams 使用围绕 zlib-ng one-shot compression 的小型 C bridge。该 bridge 将原生 zlib-ng length types 保留在 C 内部,同时保持 HotPDF 面向 Pascal 的 32-bit buffer length 和最大压缩行为

Win64x 和 diagnostic MSVC Win64 zlib-ng object builds 包含 runtime-dispatched SSE2、SSSE3、SSE4.1、SSE4.2、PCLMULQDQ 和 AVX2 实现,并带 generic fallbacks。Win32 为 bcc32c 兼容性保留 generic zlib-ng OMF objects,而 Win32 JPEG/TIFF 路径仍使用 classic bcc32 OMF objects

支持的 Function Groups

  • Memory Management: malloc, free, realloc, calloc with 32-byte aligned allocation
  • File and Stream Operations: fopen, fclose, fputc, fread, fwrite, fflush, ferror
  • String and Character Functions: strcpy, sprintf, memcpy, memmove, memset, tolower, toupper, towlower, towupper, getenv, atoi
  • Runtime Helpers: ftol, setjmp, log, snprintf, memcmp

Architecture Support

  • Win32:Pascal wrappers 和 WinAPI-backed helpers,与每个受支持 Delphi Win32 版本链接的 bcc32c 和 bcc32 OMF objects 匹配
  • Win64: msvcrt.dll imports plus small helper stubs required by the MSVC-generated COFF64 objects
  • Common Types: PtrInt and PtrUInt keep pointer-sized declarations aligned across both targets

另请参阅