Skip to content

linux support - any specific reason or just "no linux"? #6

Description

@yarikoptic

magewell SDK provides dynamic library also for Linux, so I would assume it would have similar to .dll API?

I've not done of "loading dynamic libraries from Python" recently so not sure what to do about following but I would expect it to be possible to load the .so as well:

In [1]: from ctypes import cdll

In [2]: l = cdll.LoadLibrary('./Capture/Lib/x64/libMWCapture.so')
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
Input In [2], in <cell line: 1>()
----> 1 l = cdll.LoadLibrary('./Capture/Lib/x64/libMWCapture.so')

File /usr/lib/python3.10/ctypes/__init__.py:452, in LibraryLoader.LoadLibrary(self, name)
    451 def LoadLibrary(self, name):
--> 452     return self._dlltype(name)

File /usr/lib/python3.10/ctypes/__init__.py:374, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
    371 self._FuncPtr = _FuncPtr
    373 if handle is None:
--> 374     self._handle = _dlopen(self._name, mode)
    375 else:
    376     self._handle = handle

OSError: ./Capture/Lib/x64/libMWCapture.so: undefined symbol: snd_mixer_first_elem

where that symbol is provided by /usr/lib/x86_64-linux-gnu/libasound.so, but libMWCapture.so didn't link against it... googled myself into a solution

In [3]: from ctypes import CDLL, RTLD_GLOBAL

In [4]: CDLL('libasound.so', mode = RTLD_GLOBAL)
Out[4]: <CDLL 'libasound.so', handle 5618b3565990 at 0x7f86b8247eb0>

In [5]: CDLL('libudev.so', mode = RTLD_GLOBAL)
Out[5]: <CDLL 'libudev.so', handle 5618b3568d20 at 0x7f86b3548190>

In [6]: CDLL('libv4l2.so', mode = RTLD_GLOBAL)
Out[6]: <CDLL 'libv4l2.so', handle 5618b3552d70 at 0x7f86b8158d60>

In [7]: l = CDLL('./Capture/Lib/x64/libMWCapture.so', mode = RTLD_GLOBAL)

In [11]: l
Out[11]: <CDLL './Capture/Lib/x64/libMWCapture.so', handle 5618b32912c0 at 0x7f86b83a4490>

so I guess could be loaded fine under Linux ;-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions