jhkwei 发表于 2014-05-27 11:09

64位 linux 编译程序运行不了

程序出现问题
一个回调函数,如果编译出来的指针是32位,程序可以运行,有时如果指针是64位的,程序运行不了,理论上64位机指针是64位的,为什么64位指定却运行不了,还有怎么把指定编译成32位的。

Fixend 发表于 2014-05-27 13:56

gcc -m32

timespace 发表于 2014-05-27 14:39

很可能有逻辑上的BUG,在64位下暴露了。。。

jhkwei 发表于 2014-05-27 15:18

timespace 发表于 2014-05-27 14:39 static/image/common/back.gif
很可能有逻辑上的BUG,在64位下暴露了。。。


可能性不大

大体程序如下

typdef struct test{
FILE *fp;
int size;
}test_t;

struct handler{

int (*open)(test_t *t, char *filename);
int (*read)(test_t *t, char *buf, int size);
int (*write)(test_t *t, char *buf, int size);
int (*close)(test_t *t);
};

jhkwei 发表于 2014-05-28 12:35

Fixend 发表于 2014-05-27 13:56 static/image/common/back.gif
gcc -m32

是的用gcc -m64就没有问题了
页: [1]
查看完整版本: 64位 linux 编译程序运行不了