Posts in "C++" category

Featured Image

Kodi for Android: Building and Using Binary Python Extensions - Part 1

 Nov. 12, 2016    0 comments 

Important WARNING!

On recent Android 7 firmwares for some devices, including my Samsung Galaxy Tab A 10.1, the magic workaround that allows to load binary Python modules from Kodi addons no longer works. This means that currently there is no known way to import binary modules in Python addons on such devices. Because of this the following series of articles now has only historical value since there is a strong chance that you won't be able to use your compiled binary Python module(s).


This is the 1st article in my series about building and using binary Python modules in Kodi on Android. In this article I will cover prerequisites needed to build a Python/C extension module for Python in Kodi for Android. (...)

Read post

 AndroidCC++KodiPluginPython

Featured Image

Kodi for Android: Building and Using Binary Python Extensions - Introduction

 Nov. 11, 2016    0 comments 

This is an introduction to my series of articles that describe how to build binary Python modules for Kodi addons on Android platform.

Kodi mediacenter includes a full-featured (well, almost smile) CPython interpreter for creating plugins. CPython, which is the reference Python implementation, in its turn provides the Python/C API that allows to create a binary Python extension modules in C language. These module are used, for example, to speed-up some CPU-intensive tasks, because Python, being an interpreted language, is relatively slow. (...)

Read post

 AndroidCC++KodiPluginPython

Featured Image

Wsgi-Boost-Server: A Python WSGI Server Written in C++

 July 15, 2016    0 comments 

At last I found some time to write about my recent project — WsgiBoostServer. I started it to learn C++ and, specifically, writing binary extension modules for Python using Boost.Python. As the name implies, this is a WSGI server, that is, a HTTP server for Python web applications. But in addition to Python applications WsgiBoostServer can also serve static files that allows to use it for serving standalone Python micro-services with all their static content.

Because WsgiBoostServer is written in C++ using Boost.Asio library, it is faster than pure Python WSGI servers like Waitress or CherryPy. And since it can be used as a regular Python module (although binary), it does not require complex set-up and can be included in any Python application. More info about WsgiBoostServer and its source code can be found in my GitHub repository. It's MIT-licensed so feel free to use it as you like if you find this my little side-project interesting.

Update: Unfortunately, deeper testing revealed serious problems. WsgiBoostServer works with pure-Python WSGI applications without problems but crashes because of memory corruption if I add some binary Python modules in the mix. My guess is that Boost.Asio does not work well inside a Python interpreter which does its own memory management. Since diagnosing such arcane memory problems is way over my head, I had to abandon this project frown.

Read post

 BoostC++Python

Featured Image

Boost ASIO Stackful Coroutines May Resume In A Different Thread

 May 18, 2016    0 comments 

Currently I'm learning C++ and specifically how to write binary Python modules with Boost.Python. As a part of my learning I've decided to develop a PEP-3333 compliant multithreaded WSGI server written in C++ using Boost.Asio and Boost.Python. (...)

Read post

 BoostC++Python