[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: conflicting types in windows-spawn
From: |
Markus Mützel |
Subject: |
Re: conflicting types in windows-spawn |
Date: |
Thu, 6 May 2021 15:25:01 +0200 |
Am 06. Mai 2021 um 14:28 Uhr schrieb "Markus Mützel":
> I tried to use the windows-spawn module in a project that defines UNICODE.
>
> Compilation of gnulib failed with the following error:
>
> libtool: compile: x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I.
> -I/home/osboxes/Octave/mxe-octave/tmp-default-octave/octave-7.0.0/libgnu -I..
> -I/home/osboxes/Octave/mxe-octave/usr/x86_64-w64-mingw32/include
> -fvisibility=hidden -g -O2 -MT windows-spawn.lo -MD -MP -MF
> .deps/windows-spawn.Tpo -c
> /home/osboxes/Octave/mxe-octave/tmp-default-octave/octave-7.0.0/libgnu/windows-spawn.c
> -DDLL_EXPORT -DPIC -o .libs/windows-spawn.o
> /home/osboxes/Octave/mxe-octave/tmp-default-octave/octave-7.0.0/libgnu/windows-spawn.c:415:1:
> error: conflicting types for 'compose_handles_block'
> 415 | compose_handles_block (const struct inheritable_handles *inh_handles,
> | ^~~~~~~~~~~~~~~~~~~~~
> In file included from
> /home/osboxes/Octave/mxe-octave/tmp-default-octave/octave-7.0.0/libgnu/windows-spawn.c:21:
> /home/osboxes/Octave/mxe-octave/tmp-default-octave/octave-7.0.0/libgnu/windows-spawn.h:118:12:
> note: previous declaration of 'compose_handles_block' was here
> 118 | extern int compose_handles_block (const struct inheritable_handles
> *inh_handles,
> | ^~~~~~~~~~~~~~~~~~~~~
> make[5]: *** [Makefile:3299: windows-spawn.lo] Error 1
>
>
> The following change fixes it for me:
>
> * lib/windows-spawn.h: Use ANSI structure STARTUPINFOA.
> ---
> lib/windows-spawn.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/lib/windows-spawn.h b/lib/windows-spawn.h
> index 1c29d1b17..78f11893c 100644
> --- a/lib/windows-spawn.h
> +++ b/lib/windows-spawn.h
> @@ -25,6 +25,9 @@
> #define WIN32_LEAN_AND_MEAN
> #include <windows.h>
>
> +/* Don't assume that UNICODE is not defined. */
> +#undef STARTUPINFO
> +#define STARTUPINFO STARTUPINFOA
>
> /* Prepares an argument vector before calling spawn().
>
On second thought, the header should probably better not re-define STARTUPINFO.
The following alternative change might be saver:
>From 84df3e82f88799d211bd4f5147473b238937d458 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Markus=20M=C3=BCtzel?= <markus.muetzel@gmx.de>
Date: Thu, 6 May 2021 15:20:30 +0200
Subject: [PATCH] windows-spawn: Don't assume that UNICODE is not defined
* lib/windows-spawn.h: Use ANSI structure STARTUPINFOA.
---
lib/windows-spawn.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/windows-spawn.h b/lib/windows-spawn.h
index 1c29d1b17..9bcfb1c82 100644
--- a/lib/windows-spawn.h
+++ b/lib/windows-spawn.h
@@ -116,7 +116,7 @@ extern int init_inheritable_handles (struct
inheritable_handles *inh_handles,
Returns 0 upon success. In case of failure, -1 is returned, with errno set.
*/
extern int compose_handles_block (const struct inheritable_handles
*inh_handles,
- STARTUPINFO *sinfo);
+ STARTUPINFOA *sinfo);
/* Frees the memory held by a set of inheritable handles. */
extern void free_inheritable_handles (struct inheritable_handles *inh_handles);
--
2.31.1.windows.1