Hi Bruno,

I tried further investigate this issue and I have discovered that 
libtextstyle/lib/config.h contains following lines:

```
#define sprintf libtextstyle_sprintf
#define sscanf libtextstyle_sscanf
```

Since config.h is included before any system header file, later when system's 
stdio.h is included, I assume this macro is defined and instead of 
declaring/defining inline sprintf it ends up declaring/defining 
libtextstyle_sprintf.

I believe this is what causes build error with clang-cl.

I have not investigated what causes these lines to appear in config.h. I 
believe you are familiar with gnulib's internals and how things work far better 
than me.

- Kirill Makurin
________________________________
From: Bruno Haible <br...@clisp.org>
Sent: Tuesday, June 10, 2025 11:40 PM
To: bug-gnulib@gnu.org <bug-gnulib@gnu.org>; Kirill Makurin 
<maiddais...@outlook.com>
Subject: Re: clang-cl: undeclared library function 'sprintf'

Kirill Makurin wrote:
> In MSVC headers, sprintf and friends can be either simply declared as
> externals or defined as inline functions. It seems to be controlled
> some internal (not documented) macro. I believe it should always be
> visible as an inline function to user code.

I would try to force the MSVC headers to declare 'sprintf' as 'extern',
not inline.

Bruno



Reply via email to