我认为这是一个奇怪的问题:
我有一个反转char *的C库。当我在纯python中使用ctypes时,我得到了正确的解决方案。但是,当我在django视图中尝试相同的代码时,我得到了错误的答案。
Pure Python:
import sys
from ctypes import *
path = "library.so"
lib = cdll.LoadLibrary(path)
reverse = lib.reverse
reverse.restype = c_char_p
当我使用“reverse('pepe')”时,我得到'epep'
使用django,使用相同的代码我只得到'p'。
有什么想法吗?