Skip to content

Fix Windows x86 calling convention mismatch for HPDF error handler#12

Merged
Cadons merged 2 commits into
mainfrom
copilot/update-docraft-polygon-parser
Mar 15, 2026
Merged

Fix Windows x86 calling convention mismatch for HPDF error handler#12
Cadons merged 2 commits into
mainfrom
copilot/update-docraft-polygon-parser

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 15, 2026

On Windows x86 with -DHPDF_DLL, HPDF_Error_Handler is typedef'd with HPDF_STDCALL (__stdcall), but error_handler was declared with the default __cdecl, causing a hard compile error when passing it to HPDF_New. This is a no-op on x64 where the two conventions are unified.

Change

  • Added HPDF_STDCALL to the error_handler function definition in docraft_haru_backend.cc so its type exactly matches HPDF_Error_Handler:
// Before
void error_handler(HPDF_STATUS error_no, HPDF_STATUS, void *) { ... }

// After
void HPDF_STDCALL error_handler(HPDF_STATUS error_no, HPDF_STATUS, void *) { ... }

HPDF_STDCALL is already defined by hpdf_types.h — expands to __stdcall on x86 Windows with HPDF_DLL, empty string everywhere else.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: Cadons <43477517+Cadons@users.noreply.github.com>
Copilot AI changed the title [WIP] Update docraft polygon parser for improved performance Fix Windows x86 calling convention mismatch for HPDF error handler Mar 15, 2026
Copilot AI requested a review from Cadons March 15, 2026 10:48
@Cadons Cadons marked this pull request as ready for review March 15, 2026 10:53
@Cadons Cadons merged commit 27ea3b2 into main Mar 15, 2026
5 checks passed
@Cadons Cadons mentioned this pull request Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants