[issue34603] ctypes On Windows: error calling C function that returns a struc containing 3 bools

2018-09-07 Thread MatteoL


New submission from MatteoL :

Marshalling the following C structure with ctypes in Windows (compiled with 
VS2015) is not working correctly.
As you can see, in the simple demo program I attached, the integer I pass as a 
parameter gets somehow corrupted. I use cdecl calling convention.

The corruption happens only if the returned structure contains 3 booleans, if I 
add a fourth bool to the structure than I get expected results.

In linux (compiling with Gcc) the same code (with 3 booleans) work as expected.


typedef uint64_t CustomHandle;

typedef struct
{
bool first;
bool second;
bool third;
} Flags;

CustomHandle GetHandle();
Flags GetFlags(CustomHandle handle);


As already mention I attached all the files to reproduce the issue with the 
related cmake file

--
components: ctypes
files: MarshallingTest.zip
messages: 324732
nosy: mattneri
priority: normal
severity: normal
status: open
title: ctypes On Windows: error calling C function that returns a struc 
containing 3 bools
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7
Added file: https://bugs.python.org/file47789/MarshallingTest.zip

___
Python tracker 
<https://bugs.python.org/issue34603>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34603] ctypes on Windows: error calling C function that returns a struct containing 3 bools

2018-09-07 Thread MatteoL


Change by MatteoL :


--
title: ctypes On Windows: error calling C function that returns a struc 
containing 3 bools -> ctypes on Windows: error calling C function that returns 
a struct containing 3 bools

___
Python tracker 
<https://bugs.python.org/issue34603>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34603] ctypes on Windows: error calling C function that returns a struct containing 3 bools

2018-09-10 Thread MatteoL


Change by MatteoL :


--
nosy: +amaury.forgeotdarc, belopolsky, meador.inge

___
Python tracker 
<https://bugs.python.org/issue34603>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com