Message171876
class Int(ctypes.Structure):
_fields_ = [ ("_i", ctypes.c_uint64),
("undef", ctypes.c_bool)]
class Int {
public:
Int();
Int(uint64_t i);
uint64_t _i;
bool undef;
};
extern "C" Int foo(const Int& a , const Int& b , const Int& c)
{
ret = ...
return Int(ret);
}
(gdb) p ret
$3 = 16
(gdb) fin
Run till exit from #0 BVSignExtend (a=..., b=..., c=...) at foo.hpp:130
0x00007ffff784eea4 in ffi_call_unix64 () from /usr/lib/python2.7/lib-dynload/_ctypes.so
Value returned is $4 = {_i = 18577824, undef = 16}
My guess: The value 18577824 was not expected to be on the stack.
The following actions "solve" the problem:
1) add another int the class Int (after bool) and adopt _fields_ accordingly.
2) in foo C++ function:
Int reti = Int(ret);
return reti;
Because of the "above" solutions I strongly suspect a bug in ctypes. |
|
Date |
User |
Action |
Args |
2012-10-03 09:30:39 | iroli | set | recipients:
+ iroli |
2012-10-03 09:30:39 | iroli | set | messageid: <1349256639.78.0.287581020931.issue16117@psf.upfronthosting.co.za> |
2012-10-03 09:30:39 | iroli | link | issue16117 messages |
2012-10-03 09:30:39 | iroli | create | |
|