开发者

Can Python ctypes load a 32bit C library on x86-64?

开发者 https://www.devze.com 2023-01-03 13:20 出处:网络
I have a 64 bit RHEL开发者_StackOverflow host with 32 bit libraries installed. One vendor has a 32 bit .so I\'d like to load into Python using ctypes.

I have a 64 bit RHEL开发者_StackOverflow host with 32 bit libraries installed. One vendor has a 32 bit .so I'd like to load into Python using ctypes.

from ctypes import CDLL
CDLL('32bitdinosaur.so')                        

OSError: 32bitdinosaur.so: wrong ELF class: ELFCLASS32

Of course 64 bit libraries are OK. Eg:

CDLL('libc.so.6')

Works fine.


It looks like the best way to do this is to have a 32 bit python in a separate process load the .so, and call the 32 bit python from a 64 bit Python.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号