Regenerate charmonizer.c for MinGW
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/3c9015bf Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/3c9015bf Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/3c9015bf Branch: refs/heads/master Commit: 3c9015bf6cadd0986a23c91c50752fd1b223d24b Parents: 479c277 Author: Nick Wellnhofer <[email protected]> Authored: Mon Jul 21 22:34:48 2014 +0200 Committer: Nick Wellnhofer <[email protected]> Committed: Mon Jul 21 22:34:48 2014 +0200 ---------------------------------------------------------------------- common/charmonizer.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/3c9015bf/common/charmonizer.c ---------------------------------------------------------------------- diff --git a/common/charmonizer.c b/common/charmonizer.c index 683dfe0..3318d79 100644 --- a/common/charmonizer.c +++ b/common/charmonizer.c @@ -6887,7 +6887,19 @@ chaz_SymbolVisibility_run(void) { if (chaz_CC_test_compile(code_buf)) { can_control_visibility = true; chaz_ConfWriter_add_def("EXPORT", export_win); - chaz_ConfWriter_add_def("IMPORT", "__declspec(dllimport)"); + if (chaz_CC_gcc_version_num()) { + /* + * Under MinGW, symbols with dllimport storage class aren't + * constant. If a global variable is initialized to such a + * symbol, an "initializer element is not constant" error + * results. Omitting dllimport works, but has a small + * performance penalty. + */ + chaz_ConfWriter_add_def("IMPORT", NULL); + } + else { + chaz_ConfWriter_add_def("IMPORT", "__declspec(dllimport)"); + } } }
