Reputation: 877
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
Upvotes: 3
Views: 4782
Reputation: 156158
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.
Upvotes: 3
Reputation: 21831
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").
Upvotes: 3