Hello,
Is it possible to use Py++ to "convert" structures from a C header, say
,----
| struct flock
| {
| short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
| short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
| #ifndef __USE_FILE_OFFSET64
| __off_t l_start; /* Offset where the lock begins. */
| __off_t l_len; /* Size of the locked area; zero means until EOF. */
| #else
| __off64_t l_start; /* Offset where the lock begins. */
| __off64_t l_len; /* Size of the locked area; zero means until EOF. */
| #endif
| __pid_t l_pid; /* Process holding the lock. */
| };
`----
from fcntl.h into the corresponding ctypes Structure,
,----
| class flock_t(Structure):
| _fields_ = [
| ('l_type', c_short),
| ('l_whence', c_short),
| ('l_start', c_uint64),
| ('l_len', c_uint64),
| ('l_pid', c_int)
| ]
`----
while automatically taking into account the #ifdefs and how types like
off_t and pid_t are actually defined on the target system?
The introduction on
http://www.language-binding.net/pyplusplus/pyplusplus.html says that
Py++ can act as a code generator for ctypes, but I could not find any
documentation for the sort of application that I describe here.
Best,
-Nikolaus
--
»Time flies like an arrow, fruit flies like a Banana.«
PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C
_______________________________________________
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig