Cross-Platform C Library Integration

總覽

HotPDF 使用 HPDFCLibs.pas 作為 Delphi 與 HPDFZLib.pas、HPDFJpeg.pas、HPDFTiff.pas 所用 statically linked C object files 之間面向 Pascal 的橋接。此 unit 會公開這些 libraries 期待的 runtime symbols,同時為 Win32 與 Win64 builds 保持一致的 Pascal declaration layer

Key Features

  • 供 zlib-compatible mode 的 zlib-ng、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-built zlib-ng OMF objects 及 bcc32-built JPEG/TIFF OMF objects 的 Win32 相容性
  • 與 Lib\thirdparty\Win64 中 COFF64 obj files,以及 Lib\thirdparty\Win64x 中 zlib-ng COFF objects 的 Win64 相容性
  • 供 Delphi linker 無法直接匯入 symbols 使用的 pointer-sized helper types 與 Pascal stubs

High-Performance JPEG Backend

標準 JPEG workflows 由 libjpeg-turbo 3.1.90 支援,透過 HPDFJpeg.pas 公開的 classic libjpeg-compatible API 使用。Win32、Win64 與 Win64x object builds 包含相關 NASM SIMD acceleration objects,同一組 bundled object set 也提供給 TIFF integration layer,用於 JPEG-compressed TIFF handling

Zlib-ng Bridge Notes

Win64 Flate image streams 使用圍繞 zlib-ng one-shot compression 的小型 C bridge。該 bridge 將 native zlib-ng length types 保留在 C 內,同時保留 HotPDF 面向 Pascal 的 32-bit buffer lengths 與 maximum compression 行為

Win64x 與 diagnostic MSVC Win64 zlib-ng object builds 包含 runtime-dispatched SSE2、SSSE3、SSE4.1、SSE4.2、PCLMULQDQ 與 AVX2 implementations,並具 generic fallbacks。Win32 為 bcc32c compatibility 保留 generic zlib-ng OMF objects,而 Win32 JPEG/TIFF path 仍使用 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 version 所連結的 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

請參閱