[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unictype/category-none tests: Fix a link error on MSVC
From: |
Simon Josefsson |
Subject: |
Re: unictype/category-none tests: Fix a link error on MSVC |
Date: |
Tue, 06 Sep 2022 13:11:27 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Bruno Haible <bruno@clisp.org> writes:
> On MSVC, with libunistring installed as a shared library, I get this link
> error:
>
> /home/bruno/msvc/compile cl -nologo -MD -L/usr/local/msvc64/lib -o
> test-categ_none.exe unictype/test-categ_none.obj libtests.a ../gllib/libgnu.a
> libtests.a ../gllib/libgnu.a libtests.a -lunistring
> test-categ_none.obj : error LNK2019: unresolved external symbol
> _UC_CATEGORY_NONE referenced in function main
> test-categ_none.exe : fatal error LNK1120: 1 unresolved externals
> make[4]: *** [Makefile:16335: test-categ_none.exe] Error 2
>
> The reason is that _UC_CATEGORY_NONE is not a public API of the shared library
> and therefore not exported. The simplest fix is to disable the test.
Thanks -- although isn't that also a bug in libunistring that the symbol
is visible for non-MSVC? Shouldn't be hidden?
/Simon
>
> 2022-09-04 Bruno Haible <bruno@clisp.org>
>
> unictype/category-none tests: Fix a link error on MSVC.
> * tests/unictype/test-categ_none.c (main): Disable the test on MSVC.
>
> diff --git a/tests/unictype/test-categ_none.c
> b/tests/unictype/test-categ_none.c
> index 4615fb162b..913011a5e4 100644
> --- a/tests/unictype/test-categ_none.c
> +++ b/tests/unictype/test-categ_none.c
> @@ -25,11 +25,18 @@
> int
> main ()
> {
> + /* This test cannot be compiled on platforms on which _UC_CATEGORY_NONE
> + is not exported from the libunistring shared library. For now,
> + MSVC is the only platform where this is a problem. */
> +#if !defined _MSC_VER
> +
> uc_general_category_t ct = _UC_CATEGORY_NONE;
> unsigned int c;
>
> for (c = 0; c < 0x110000; c++)
> ASSERT (!uc_is_general_category (c, ct));
>
> +#endif
> +
> return 0;
> }
>
>
>
>
>
signature.asc
Description: PGP signature