common: support win-iconv's const iconv() prototype - #9
Merged
Conversation
iconv()'s second argument is 'char **' on glibc and GNU libiconv, but 'const char **' on win-iconv (the POSIX/SysV signature) - which is what Fedora's mingw stack ships. charset.c hard-coded 'char *', so it failed to compile (-Wincompatible-pointer-types) against win-iconv even though it built fine against the GNU libiconv used by the MSYS2 CI leg. Detect the prototype at configure time (a -Werror cc.compiles() probe, the autotools ICONV_CONST idiom) and type charset.c's input pointer through the resulting SEER_ICONV_CONST macro - 'const' for win-iconv, empty for glibc/GNU libiconv - so it is warning-clean under either. This makes the protocol core cross-compile cleanly with the Fedora mingw-w64 toolchain (relevant both for local Windows-port iteration and for any future Fedora mingw package of SeerODBC), with no change on the existing Linux/macOS/MSYS2 builds. Verified: full mingw cross-build links; native Linux unchanged (offline 9/0/4, live 11g integration OK). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A small, self-contained portability fix that unblocks cross-compiling the protocol core with Fedora's mingw-w64 toolchain. Split out ahead of the ODBC-shim Windows port (Phase 2) since it's independent.
The problem
iconv()'s second argument ischar **on glibc and GNU libiconv, butconst char **on win-iconv (the POSIX/SysV signature) — which is what Fedora's mingw stack (mingw64-win-iconv) ships.charset.chard-codedchar *inbuf, so it compiled fine against the GNU libiconv used by the MSYS2 CI leg but failed (-Wincompatible-pointer-types) against win-iconv.This matters beyond local tooling: any future Fedora mingw package of SeerODBC would link win-iconv and hit the same wall.
The fix
Detect the prototype at configure time — a
-Werrorcc.compiles()probe (the autotoolsICONV_CONSTidiom) — and typecharset.c's input pointer through the resultingSEER_ICONV_CONSTmacro:constfor win-iconv, empty for glibc/GNU libiconv. Warning-clean under either, no runtime change.Verification
charset.c).🤖 Generated with Claude Code