在C扩展名.pyd中,sizeof INT64 = 4? [英] In C extension .pyd, sizeof INT64 = 4?
问题描述
我的C扩展程序运行错误,并调试它,发现sizeof(INT64)=
4,而不是8.
我在Windows XP平台上编译。 />
请告诉我如何解决它以支持INT64?
谢谢。
< blockquote> 6月12日,6月3日,Allen< Allen.Che ... @ gmail.comwrote:
我的C扩展工作错误,调试它,发现那个sizeof(INT64)=
4,不是8.
我在Windows XP平台上编译。
请告诉我如何修复它支持INT64?
谢谢。
我发现它很奇怪。在exe win32控制台项目中,sizeof(INT64)=
8.
我的代码是这样的:
/ * my.h头文件* /
#ifdef __cplusplus
extern" C" {
#endif
静态PyObject *方法(PyObject * self,PyObject * args);
# idef __cplusplus
}
#endif
/ * my.cpp源文件* /
PyObject *方法(PyObject * self,PyObject * args)
{
INT64 nValue; / * LINE_HERE * /
INT32 nRet;
nRet = DoSomeCOperations(nValue);
返回PyBuildValue(" i",nRet);
}
如果我在LINE_HERE将INT64 nValue更改为静态INT64 nValue,那么
就可以了。
为什么?
En Tue,2007年6月12日08:39:43 -0300,Allen< Al ********** @ gmail.com>
$ b $bescribió:
PyObject *方法(PyObject * self,PyObject * args)
{
INT64 nValue; / * LINE_HERE * /
INT32 nRet;
nRet = DoSomeCOperations(nValue);
返回PyBuildValue(" i",nRet);
}
如果我在LINE_HERE将INT64 nValue更改为静态INT64 nValue,那么
就可以了。
为什么?
我不知道,但我不知道Python涉及哪个地方......你不是
使用任何参数,返回的Python对象不是INT64 ......
Gabriel Genellina
6月12日,8月8日,Gabriel Genellina, < gagsl -... @ yahoo.com.arwrote:
En Tue,2007年6月12日08:39:43 -0300,Allen< Allen.Che ... @ gmail.com>
$ b $bescribió:
PyObject *方法(PyObject * self,PyObject * args)
{
INT64 nValue; / * LINE_HERE * /
INT32 nRet;
nRet = DoSomeCOperations(nValue);
返回PyBuildValue(" i",nRet);
}
如果我在LINE_HERE将INT64 nValue更改为静态INT64 nValue,则
还可以。
为什么?
我不知道,但我也看不到Python涉及的地方......你不是
使用任何参数,返回的Python对象不是INT64 ...
-
Gabriel Genellina
问题显然是涉及编译器。
但我不知道为什么INT64的大小改为4.
My C extension works wrong, and debug it, found that sizeof (INT64) =
4, not 8.
I compile on Windows XP platform.
Please tell me how to fix it to support INT64?
Thanks.
On 6 12 , 6 03 , Allen <Allen.Che...@gmail.comwrote:My C extension works wrong, and debug it, found that sizeof (INT64) =
4, not 8.
I compile on Windows XP platform.
Please tell me how to fix it to support INT64?
Thanks.I find it is strange. In an exe win32 console project, sizeof(INT64) =
8.
My code is just like this:
/* my.h header file */
#ifdef __cplusplus
extern "C" {
#endif
static PyObject* method(PyObject* self, PyObject *args);
#idef __cplusplus
}
#endif
/* my.cpp source file */
PyObject* method(PyObject* self, PyObject *args)
{
INT64 nValue; /* LINE_HERE */
INT32 nRet;
nRet = DoSomeCOperations(nValue);
return PyBuildValue("i", nRet);
}
If I changed INT64 nValue to be static INT64 nValue at LINE_HERE, it
is ok.
Why?
En Tue, 12 Jun 2007 08:39:43 -0300, Allen <Al**********@gmail.com>
escribió:
PyObject* method(PyObject* self, PyObject *args)
{
INT64 nValue; /* LINE_HERE */
INT32 nRet;
nRet = DoSomeCOperations(nValue);
return PyBuildValue("i", nRet);
}
If I changed INT64 nValue to be static INT64 nValue at LINE_HERE, it
is ok.
Why?I don''t know, but I don''t see either where Python is involved... you don''t
use any argument and the returned Python object is not an INT64...
--
Gabriel Genellina
On 6 12 , 8 08 , "Gabriel Genellina" <gagsl-...@yahoo.com.arwrote:En Tue, 12 Jun 2007 08:39:43 -0300, Allen <Allen.Che...@gmail.com>
escribió:
PyObject* method(PyObject* self, PyObject *args)
{
INT64 nValue; /* LINE_HERE */
INT32 nRet;
nRet = DoSomeCOperations(nValue);
return PyBuildValue("i", nRet);
}
If I changed INT64 nValue to be static INT64 nValue at LINE_HERE, it
is ok.
Why?
I don''t know, but I don''t see either where Python is involved... you don''t
use any argument and the returned Python object is not an INT64...
--
Gabriel GenellinaThe problem is obviously compiler involved.
But I don''t know why the sizeof INT64 is changed to be 4.
这篇关于在C扩展名.pyd中,sizeof INT64 = 4?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!