Win How to import dll from c++ to an addon for xbmc
#1
Hello everyone, I'm kinda new in xbmc, and Im trying to import a .dll from c++ in the addon.py file. However, after hours of trial and error I get this message:

XBMC.exe': Loaded 'C:\XBMC\system\python\DLLs\_ctypes.pyd', Cannot find or open the PDB file
EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.WindowsError'>
Error Contents: (126, 'The specified module could not be found')
Traceback (most recent call last):
File "C:\XBMC\addons\script.service.sum_numbers\addon.py", line 6, in <module>
mydll = windll.LoadLibrary('summation.dll')
File "C:\XBMC\system\python\Lib\ctypes\__init__.py", line 443, in LoadLibrary
return self._dlltype(name)
File "C:\XBMC\system\python\Lib\ctypes\__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: (126, 'The specified module could not be found')
-->End of Python script error report<--

Basically my Addon.py looks like this:

import sys
import xbmc, xbmcgui
import xbmcplugin

from ctypes import windll
mydll = windll.LoadLibrary('summation.dll')
print(mydll.sum())
print '------------!!!!! hello world !!!!!!! ----------'


I'm wondering if is actually possible do the above, where the mydll.sum() its just a function written on a .cpp file that outputs a value. Therefore, the my question is fairly simple ... how do we import the dll files from c++ to an addon for xbmc?

Thanks in advance!
Josue
Reply
#2
XBMC does support code generation to extend XBMC's existing Python API, checkout http://wiki.xbmc.org/index.php?title=Codegeneration

But as I understand it importing a .dll or .so from a Python script is not supported?

PVR addons and Visualization addons are really the only specific types of binary addons supported by XBMC so far?
Reply
#3
Well my idea was basically to create a plugin which will process a video (inspection of every frame), but the processing part will be done in c++, where XBMC will just help me for visualization purposes. Therefore, the goal of importing my .dll files was to basically leave the nasty part (computation, and other calculations) to c++ itself, while my .py file will be in charge of calling functions and output the results in XBMC.
The reason of the aforementioned is because of the nice interface provided by the framework (xbmc), and of course I want to avoid changing the project source code itself.
Reply
#4
I don't think XBMC supports C++ Python interfacing. A better approach is to use sockets, have the C++ code manage the video processing then pass the data over to your python addon over sockets. Would also allow for the C++ code to run on one machine and XBMC on the other.

May I ask why you are trying to achieve this in the first place.
Reply
#5
Well my friends, I thought it will be very interesting if a plugin for video surveillance could be implemented in xbmc as shown here: http://www.contaware.com/content/view/44/46/, and given the nice interface of xbmc it would be pretty nice to have this.
Reply
#6
Dumb question but I see you're just specifying the filename, have you tried passing the full path\filename?
Reply

Logout Mark Read Team Forum Stats Members Help
How to import dll from c++ to an addon for xbmc0