Re: (from stdlib-sig) ctypes or struct from an h file

2009-10-19 Thread Yuvgoog Greenle
Ok I see your point that C is ambiguous concerning compiler implementation. I think #pragma pack should work out the padding issue but I'm not sure if the floating point issue is solvable. I don't have an idea for solving that one... On Sun, Oct 18, 2009 at 11:14 PM, Erik Max Francis

(from stdlib-sig) ctypes or struct from an h file

2009-10-18 Thread Yuvgoog Greenle
Is there a way that Python and C can have a shared definition for a binary data structure? It could be nice if: 1. struct or ctypes had a function that could parse a .h/.c/.cpp file to auto-generate constructors or 2. a ctypes definition could be exported to a .h file. So my question is - is

Re: (from stdlib-sig) ctypes or struct from an h file

2009-10-18 Thread geremy condra
On Sun, Oct 18, 2009 at 2:44 PM, Yuvgoog Greenle ubershme...@gmail.com wrote: Is there a way that Python and C can have a shared definition for a binary data structure? It could be nice if: 1. struct or ctypes had a function that could parse a .h/.c/.cpp file to auto-generate constructors

Re: (from stdlib-sig) ctypes or struct from an h file

2009-10-18 Thread Yuvgoog Greenle
I'd like to clarify the use case. Lets say you're writing a client and a server, one is in python and the other is C. If these 2 programs need to pass binary information between them (lets say over a socket) there are 2 options, it could be nice if you could only write the struct once (either in

Re: (from stdlib-sig) ctypes or struct from an h file

2009-10-18 Thread geremy condra
On Sun, Oct 18, 2009 at 4:13 PM, Diez B. Roggisch de...@nospam.web.de wrote: Yuvgoog Greenle schrieb: Is there a way that Python and C can have a shared definition for a binary data structure? It could be nice if: 1. struct or ctypes had a function that could parse a .h/.c/.cpp file to

Re: (from stdlib-sig) ctypes or struct from an h file

2009-10-18 Thread Diez B. Roggisch
geremy condra schrieb: On Sun, Oct 18, 2009 at 4:13 PM, Diez B. Roggisch de...@nospam.web.de wrote: Yuvgoog Greenle schrieb: Is there a way that Python and C can have a shared definition for a binary data structure? It could be nice if: 1. struct or ctypes had a function that could parse a

Re: (from stdlib-sig) ctypes or struct from an h file

2009-10-18 Thread exarkun
On 08:13 pm, de...@nospam.web.de wrote: Yuvgoog Greenle schrieb: Is there a way that Python and C can have a shared definition for a binary data structure? It could be nice if: 1. struct or ctypes had a function that could parse a .h/.c/.cpp file to auto-generate constructors or 2. a ctypes

Re: (from stdlib-sig) ctypes or struct from an h file

2009-10-18 Thread Erik Max Francis
Yuvgoog Greenle wrote: I'd like to clarify the use case. Lets say you're writing a client and a server, one is in python and the other is C. If these 2 programs need to pass binary information between them (lets say over a socket) there are 2 options, it could be nice if you could only write