Hello I have this code that runs perfectly on Windows:
import ctypes
import sys
import os
from ctypes import *
from numpy import *
import time
from ctypes.util import find_library
libEDK = cdll.LoadLibrary("edk.dll")
I try running this on Ubuntu and I get this:
Traceback (most recent call last):
File "/home/nassar/Downloads/python/sds.py", line 9, in <module>
libEDK = cdll.LoadLibrary("/home/nassar/Desktop/python/edk.dll")
File "/usr/lib/python2.7/ctypes/__init__.py", line 443, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /home/nassar/Desktop/python/edk.dll: invalid ELF header
On Linux, we have something called shared object
(.so) instead of DLL's.
Long story short: you can't load a Windows DLL on a Linux system. You need to compile a Linux shared library ("edk.so").
er... you can't do that;
Shared libraries are very OS dependent, so a library built for windows cannot possibly work in linux, or visa versa.
Except that you might get some luck with Wine , which is a Windows runtime which works across many platforms. I have certainly had some success running Python binaries within wine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.