• Uncategorized

    A C++ Smart Pointer wrapper for use with JNI

    Introduction In this article, I'll propose a solution for managing native C++ resources from JNI using smart pointers. While Smart Pointers can't be useful from Java, because of the limits of the Java memory management, it may be required by the native library to maintain allocated resources through shared_ptr or unique_ptr, for example because classes derive from std::enable_from_this. Since there is a fixed pattern to maintain native objects in Java classes, a utility C++ class is proposed. The problem of memory management when integrating Java and C++ code Recently, I had to port a library I wrote for Linux to Android. For instance, the library is aimed at implementing an…

  • c++,  Code,  Linux,  Uncategorized

    The dbus-cpp Library, introduction

    While working on a bluetooth based embedded device, I needed to deal with the somehow infamous dbus. DBus and Bluez5 have a very steep learning curve, and if you are don't have access to either Qt framework or glib framework, you have indeed a problem. Glib are very complex C libraries that mimick some of the built-in feature of the C++ language, while on the other hand, Qt are very vast and sometime a big overkill. The stunning news is that it seems there aren't many options if you need a C++ only lightweight solution. It is not true, indeed. Somehow well hidden in the creases of the web, I…

  • Uncategorized

    Tech blog

    Welcome to my tech blog. Here you’ll enjoy articles about all the fields related to my work, especially Linux, Embedded systems, Programming, Software and Hardware design and Engineering. All posts will be, hopefully, in English, some will be in Italian when the argument will suggest that only Italian people will have interest on that. Sorry guys 😉 If something isn’t clear, or if you feel that some should be corrected, please write me a comment. Comments are welcome, but due to spamming issues, they will be moderated.