CppCast - Djinni

Episode Date: May 14, 2021

Rob and Jason are joined by Harald Achitz. They first discuss performance updates for debug builds coming in the next version of Visual Studio. Then they talk about Djinni, the cross platform language... binding generator tool initially developed by Dropbox that is now being supported by the C++ Mobile Development community. News 2x-3x Performance Improvements for Debug Builds Vcpkg site now has search Should we break ABI is the wrong question Links Djinni Djinni on GitHub Mobile C++ Slack C++ User Groups of Sweden C++ Community Organizers Sponsors C++ Builder

Transcript
Discussion (0)
Starting point is 00:00:00 Thank you. Prototyping, developing, and shipping are easy with C++ Builder. Start for free at Embarcadero.com. In this episode, we discuss performance improvements and debug builds. Then we talk to Harold Rockets. Harold talks to us about Gini, the first podcast for C++ developers by C++ developers. I'm your host, Rob Irving. Joined by my co-host, Jason Turner. Jason, how are you doing today? I'm okay, Rob. How are you doing? Doing okay. Coming up on another big round number. That's what they tell us. Yeah. You know, I sometimes forget about it because I always mention the number in the opening of
Starting point is 00:01:42 the episode, but I don't list it on the website or anything. Maybe I should. Oh, is that right? I don't think it's easily discoverable on the website. Huh. Yeah. I never paid attention, I guess. Well, at the top of every episode, I laid out a piece of feedback.
Starting point is 00:01:57 We got this tweet from Steven, and this is from a conversation between you and him on Twitter over the last week. Jason, do you want to tell us a little bit about this conversation? Yeah, this was in response to my YouTube video about breaking ABI, basically. And so, Steven relayed a story about the situation that he was in at work and a company that couldn't update tools, couldn't update tool chains at all. And I said, you know, I was thinking about starting like a Twitter campaign to help people like you find new jobs. Right. So he, he wrote, I just needed a push to apply for new jobs before the mass layoffs came around.
Starting point is 00:02:38 The search works better when you're currently employed. Plus you have a bit more freedom to study up for harder technical interviews. And yeah, I mean, if you're not in a good place, especially if you feel like your company is not like progressing technically, then maybe it's worth looking around. Yeah, Stephen suggests, he says, if you're listening to this and in a job
Starting point is 00:02:58 where people aren't trying to learn or grow, you should be searching for a better job. It's okay to leave your current one. That's Stephen's advice. I do find it fast. What's that? Sorry. You said lots of opportunities are out there. It does seem like that's the case right now. Yeah. And I do find it surprising how it does seem true that if you currently have a job, it's easier to find a new job, which seems incredibly unfair, really. Yeah. Yeah, definitely. Okay. Well, we'd love to hear your thoughts about the show. You can always reach out to us on Facebook, Twitter,
Starting point is 00:03:28 or email us at feedback at cppcast.com. Don't forget to leave us a review on iTunes or subscribe on YouTube. Joining us today is Harald Akkets. Harald is a longtime developer who worked in a wide range of different fields and on all major platforms mostly, but not exclusively, in projects where C++ played an important role. He works as a freelancer in Stockholm and has recently joined Tobii,
Starting point is 00:03:51 the world's leading supplier of eye-tracking technology and eye-tracking solutions. In his spare time, he likes to be with his family, contribute to open-source software, and manage communities. One of his favorite activities is organizing the Stockholm C++ Meetup Group, Stockholm CPP.
Starting point is 00:04:07 Harald, welcome to the show. Yes, thanks. Hi, Orpah, Jason. I'm very happy you have me, and I'm very excited also to be here. It's great to have you here. I'm very curious. You say all major platforms. I'm curious if you've targeted any minor platforms though well if you if you um self-made linux distributions okay less minor platforms than embedded linux yes self-made linux distributions that's uh i've never i've never gone down that route there's the people that like the like linux from scratch kind of scenario um yes but you don't use it actually. You use tools like either Yocto or Buildroot.
Starting point is 00:04:48 And this gives you a base distribution with recipes which you adapt, and then you put together where to say, I want to have this software in these packages. And then you build, and it outputs the image on the root file system and the cross-compilation tools you need. So are you currently running one of your custom world Linux distributions on any of your machines? Here, not. But in Job, there are several different targets, yes.
Starting point is 00:05:18 That's cool. Yeah. We might have to ask you more about your eye-tracking software later as well. Yeah, that does sound interesting. Yeah. All right, well, Harold, we've got a couple news articles to discuss. Feel free to comment on any of these,
Starting point is 00:05:31 and we'll start talking to you more about the world of C++ Mobile, okay? Okay, sounds good. All right, so this first one is an upcoming update from Visual Studio. This is a post on the Visual C++ blog, and this is 2 to three X performance improvements for debug builds. And I am really looking forward to this. It's coming in Visual Studio 2019 16.10.
Starting point is 00:05:55 I think the preview built for that is out now. But yeah, two to three X performance improvement for debug builds. I saw a lot of people talking about this one on Twitter, especially game developers, talking about how much they're looking forward to this because if you need to debug a game, like a AAA 3D game that you're working on
Starting point is 00:06:16 and you're trying to play through it in debug mode, it can be extremely difficult to do. Those games would get really slowed down from being debugged so they're really looking forward to this i'm really looking forward to myself i love the uh timing graph in the results section of this article because it kind of says ominously project one and project two are customer provided samples so i'm like like, but wait, project two, it makes it sound like they're anonymized, but project two actually is a clickable link. And project two is someone's article from two and a half years ago, roundabout, where they're compiling debug and release builds of their
Starting point is 00:06:58 project on various platforms. And a debug run on Visual Studio is like 30 times slower than clang so two to three times a performance improvement is huge but still shows that they probably still have a ways to go compared to some of the other compilers but it's it's all their um error checking stuff that helps you debug your program if there's a problem in debug mode so it it makes sense yeah and we often talk about how visual studio you know one of the advantages it has over other you know platforms and ids is the debugger so it makes sense that the debugger might be a little bit slower because it's doing so much for you. Harold, are you a Visual Studio user or other platforms? Not in particular, but I like to write the code in a way that it also compiles with Visual Studio.
Starting point is 00:07:53 And one of the reasons is the debug build, because it enables so much checks. And some of the checks you can also have with Clang or GCC, but you need to provide extra compiler flags. And then you are API incompatible. And Visual Studio, everyone expects that you have debug builds from all your dependencies down to the runtime, right? So this is just there. And you get a lot of information, checks, additional checks in your programs if you run the debug builds and the unit test in debug mode.
Starting point is 00:08:25 So this is good, and performance improvements is for sure a good thing, Alex. Yeah, definitely. All right, next thing we have is a link to VC package. And, you know, we had Nicole Mazzucca on a couple months ago, and one of the things we talked about with her was that VC package was going to be searchable. And I'm not sure if this just came out now or if it was out a little bit earlier.
Starting point is 00:08:49 But this is VC packages new search page where you can easily go and look for what packages are available. I think they used a C++ now talk to announce this, perhaps. Something like that. It was very recent that they announced it. Nicole mentioned it was coming when we had her on, though, right? I believe so. Yeah. But yeah, they have 1,656
Starting point is 00:09:14 packages up right now. So definitely have a lot to offer. Very cool. Are there one of you using package management at the moment for C++ work? I'm starting to look more into Conan. I used Conan a lot and I also used to VC package. I haven't tried VC package in a while. The last time I tried it, I kind of felt like it was very heavy handed. Like you run
Starting point is 00:09:38 VC package and it's like, well, I have to have my version of CMake and I have to have whatever. And I'm like, you know what? I have all these things already. I feel like I need to give it another shake again, I guess, just to see how it looks today. Probably worthwhile. All right. And then this last post we have is UC Pockinan's blog we've had on the show before. And he has this post.
Starting point is 00:10:03 Should we break the ABI is the wrong question. And obviously this is a topic we've been talking about a lot on the show lately with whether or not C++ ABIs should be broken. But he brings up an interesting point that, you know, that's maybe not the right discussion to have. We should be talking more about how we can break it safely and, and not, or maybe breaking it is not the right word,
Starting point is 00:10:28 but be able to handle ABI changes in a safe manner. Right, Jason. Yeah. So we can move forward when the time comes. I still find it interesting, I guess, because visual studio didn't guarantee ABI compatibility before Visual Studio 2015.
Starting point is 00:10:46 Before that, every release of Visual Studio broke ABI. Right. They still break it between debug and release build. Right. And I'm not sure about this blog post. I mean, it basically suggests to have different folders and putting very behind a folder as you do with architecture. But this doesn't respect that this would be just for the C++ world
Starting point is 00:11:08 and no one would love C++ if we really need this. The other thing is for Linux distribution, it's also not a major issue. Red Hat and OpenSUSE, they rebuilt from source everything. So they just updated the compiler, rebuilt everything at the flex and have the new API in place. And then they stay for the supported time period with what they have. And it's also a question with technologies like Flatpak and Snap and Docker Container, if this is where you surround things in isolation anyway,
Starting point is 00:11:41 you can put in what you want if this is such a huge issue. Yeah, I've only briefly used Docker containers for this kind of thing. Someone in my YouTube video commented that apparently Docker is now starting to experience its own version of DLL hell. And so there's some discussion about containers of containers to avoid these issues. We're all just doomed at this point, I think. I mean, technically speaking, you can maybe
Starting point is 00:12:15 do a lot. The Apple world has, you can make universal binaries where you get two architectures or four architectures, even for different platforms into one binary. So technically there is a lot possible. The question is if anyone will implement this on the operating system level just for C++, and I don't think that this will ever happen. So I think just break the API and rebuild the stuff, and if you can't rebuild it, you're stuck with the compiler version, and that's how it is, right?
Starting point is 00:12:42 Right. So I guess, Harald, you're of the opinion that it should be okay to break ABI. We should just rebuild everything. Of course. I mean, maybe in the same way, not like just for the sake of breaking the API, but when there are good reasons
Starting point is 00:12:55 that give subtle improvements that are measurable, then this should be happening, yes. Not measurable improvements, that sounds like a good litmus test. Whatever, something like that. Alright, well Harold, you reached out to me after
Starting point is 00:13:16 we talked about C++ Mobile and I think in some feedback from an earlier episode and it's certainly been a long time since we had an in-depth discussion of the state of mobile development with C++. So do you want us to maybe bring us up to speed about your thoughts on the current state
Starting point is 00:13:35 of C++ mobile development? Well, okay, the current state of C++ mobile development is quite a question. What do you mean when you talk about mobile development, right? So the first thing you have in mind is very likely iOS and Android and apps you run on them. Sure. But there is, of course, more.
Starting point is 00:13:56 There are people that run their own Android system and they put it in cars. And then you have a system programming part, more on Android than on the iOS. You have different feature phones where I cannot speak a lot about. These are very cheap phones and very cheap hardware or inexpensive
Starting point is 00:14:14 hardware in countries like India and so I cannot speak about them but someone needs to make the operating systems and the application for them also. And they are most likely in a native language, C or C++. Then you have, of course, niche projects like Jolla, which is a Finnish company which makes operating systems,
Starting point is 00:14:38 Sailfish OS for mobile phones, which is Linux under the hood and with rather the user interface is Qt or Qt and then there is of course UbiPort which is the continuation of Ubuntu touch where Ubuntu wanted to bring their stuff on the mobile phone which is also a Linux phone with a with a flavor of Qt so then when you have this when you take these two and you say okay then you're in qt land in developing or qml so there is of course a very strong relation to c++ then there are various other things like like the pine pine platform pine phone which make an inexpensive linux phone telephone and they have also an ARM notebook.
Starting point is 00:15:26 And I think they will also bring up a watch sooner or later. Oh, I didn't know about the watch. I think they tried to make a whole ecosystem around this. So there is this. I cannot say how open this is, but I would imagine this is just like any other Linux to develop for. So you might have options for C++. Yeah, this is the thing.
Starting point is 00:15:50 So for the system, you're always in a native language, like C and C++, right? And when it comes to app, the question is why do you use C++ for anything in an app? And there are multiple answers. One answer is maybe you have already code that you just want to share and you don't want to re-implement or it's not possible to re-implement due to performance requirements because I think we all agree that C++ is still very fast and maybe faster than the
Starting point is 00:16:20 other options you have. And then there is of of course, just the idea of sharing code. And this is maybe one of the most difficult ideas, but just sharing code, because there are a lot of different options for sharing code on the mobile platform. There is Xamarin for.NET. There's React Native. There is Kotlin Native also these days.
Starting point is 00:16:45 There is what is called native also these days. There is what is called Flutter from Google. So they all promise write one code and use it on multiple platforms. None of this has been the killer reason to do so. Zblast was also not the killer reason right and most likely the reason what i think is you're going to into into mobile development world where you have ios developer and android developer they are very occupied by the infrastructure by what's going on on the phone what's the development on the devices the development on the platform itself and and and when you bring them a different language or different technology, they have a hard time to say, oh, this is cool. And I think we have seen this happen on multiple places, like, for example, Dropbox and on Slack also later, who started with a shared code base and then said okay let's let's
Starting point is 00:17:51 Just continue with two development teams, but I think it still can be a good idea to share C++ code It's not particularly difficult to develop for both platforms So for for both platforms if you are if you develop with CMake you can use toolchains toolchain files, CMake toolchain files So one is in the NDK when you install the native development kit for Android. You have in the folder the CMake 2gen file and you just say CMake here is my 2gen file and please use this Android platform, this API and then you are good to go and for iOS it's pretty similar. There is an iOS toolgen file that you can utilize where you just set up a few variables I want to simulate or want the device.
Starting point is 00:18:32 Here is the toolgen file and you are good to go. The problem of course is you develop something and you can make the dependencies with it. So I have good success with Conan creating dependencies. So Conan package you the NDK and package the iOS toolchain so you can rebuild all your dependencies with Conan if you want and use them. But then you end up with C++ with a component, right? And this component you need to deliver to iOS or Android developer. And this is a very critical part in the whole process how do you do this, right?
Starting point is 00:19:09 So the best case would be probably to have to deliver this like any sort party library for them that they don't know this is a C++ component, then they will have just something they include into a project and will use and maybe
Starting point is 00:19:24 not ask. If you let them notice that this is C++ by creating Xcode project and add the C++ files there and they will see it or having the your C++ project in Android Studio and Android Studio build it and they will see it, it's maybe a little bit difficult because these people are not C++ developers. And if you're not a C++ developer, then you have to deal with the C++ infrastructure. It's very difficult. So this is maybe a little bit of an overview.
Starting point is 00:19:59 Okay. Well, since you mentioned Dropbox, it's been a while, but we have had a developer from Dropbox on a long time ago talking about Ginny, their cross-platform library, which they unfortunately did abandon, I think, a year or so ago. Do you want to tell us about Ginny and the current state of that? Because the open source community has kind of embraced and kept it going, right? Well, this is actually the reason why I reached out to you. So in my previous job at Electrolux, we were using Genie. And Genie is basically a tool to generate Clio code to use C++ code in Java or in Objective-C and with Objective-C also in Swift and via Java also in Kotlin.
Starting point is 00:20:53 And yeah Dropbox was using this, was developing this and made it open source and this was great and then quite some project adopted it. So you had last year, let me look at my notes. You had Dave Hagedorn in the show last year. So they also used, he also mentioned Genie that they use it. And I think even Google is using it. If you look at the Chrome credits, if you type chrome credits
Starting point is 00:21:26 then you get a list of third party software they use and they have a link to Genie on the mobile phone not on the browser so at least on iOS this is the case so yeah a lot of people were using this project
Starting point is 00:21:44 and there is a Slack channel and so there was still a little bit of ongoing discussion. And me and a few others, we said, oh, it would be nice if this would be maintained because people have ideas. There were a lot of not merged pull requests where people provided solutions for problems and they just, yeah yeah no one will ever merge this pull request and my personal motivation was i was i wanted just to have from the generated code a few locations adapted where the header files are located to because you say genie generate
Starting point is 00:22:20 the glue code and it generates implementation files and public header files and I wanted to have all the public header files in one folder that I can just say install this folder without looking which one is it right. And then other people had also said yeah it would be nice if there would be some development and we grouped as we started with three people and made a GitHub organization. And mostly me and Johannes Kraft have been very active at the beginning. And what we did was, first of all, splitting the project in its component. Because it was one repository and it included a lot of things. So we have the Genie generator, which is for taking an interface definition file and generating the glue code that you need.
Starting point is 00:23:08 Then you need a support lib that provides some common functionality to use the generated code. Then there was an IntelliJ plugin that you have syntax highlighting for the interface definition files in Android Studio or C-Line or whatever you use. And so the first thing was, okay, we looked at this and we split it up in the new GitHub organization. And from there on, we added a few stuff, we improved some things, like I added my header location out. So this is now as I wanted. I think we have a super nice documentation. We have continuous integration pretty good, so we skipped up actions. The pull requests were on all the unit tests. And for the IntelliJ even continuous delivery. When you tag it, it goes automatically to
Starting point is 00:24:11 the chatroom job. And then after a few while, some people dropped out, others came in. And it grew a little bit over the time, over the last six months, a little bit more. In the most recent time, we had new language bindings added, namely Python. So the Python binding has been developed actually already by Dropbox, and they have been in a branch. But they never made it into master. Oh, so you can now do Python in addition to Java and Swift? Exactly, yes. So it was there, and we looked at it and said, it's actually very, very sad that this is
Starting point is 00:24:52 there and it's rotting the code, right? And a Canadian guy, Leandro, I hope I said the name correct, he has done a huge step with this, cleaning it up, because it was several years old and there was this Python 2, Python 3 situation. And we said, okay, let's clean this up and throw this out. And also there was C++ 17 was not here when Dropbox used it. So optional was how do we handle optional? Now we said, okay, let's go to C++17.
Starting point is 00:25:25 And from the same channel, also from Lea Antota, comes the C-sharp binding. It's C++ slash CLI. It's absolutely something I have no clue about. This managed C++. But there is now a generator also for this code. So if you're on the Windows platform, you can share your C++ code with C Sharp also. So at the moment, you can generate Objective-C, Java, Python, and the code you need to interface with C Sharp. Very nice. So it sounds like the project's advanced a lot
Starting point is 00:26:03 since Dropbox abandoned it now. Yes. Since I said this, my motivation was there is this project and it's rotting, but it's a good project and it has real world user. So because I communicated with them and I've seen it and I'm self-using it. And it's actually
Starting point is 00:26:20 a pretty good project. So the it's very well, I think it's a good project so so the the it's very well i think it's a it's a it's a good project it's well designed the the interface definition language is is is simple but gives you a good way to express what you want to do is tailored to to to what we call modern C++ or post-C++, 11 C++, from what it supports. And I thought about this, right? When you do a little bit and stick with it, you show continuation and show the people that you are behind this project
Starting point is 00:26:57 and create a little bit of infrastructure that people can contribute. This will happen, and it's not two people anymore we have some people someone contributed for visual studio code the syntax highlighting file so the whole project went into the our github organization and the smaller fixes and i invite everyone who is interested step by and by and contribute to the project. I try to have an open philosophy for what's going in. So as long as it's tested and it doesn't destroy things that already work,
Starting point is 00:27:36 it's okay, right? People do it in their spare time. It needs to be somehow maintainable for others later. But besides this, we are open for a lot of things. And this is also why the Python and the C Sharp implementation came into the project recently, the philosophy behind this. Yeah, I'm definitely going to take
Starting point is 00:27:57 another closer look at this myself now that I know it has C Sharp binding support as well. A little bit of warning, this is still new and experimental. Still new, okay. I want to end up the discussion for just a moment to bring you a word from our sponsor, C++ Builder,
Starting point is 00:28:12 the IDE of choice to build Windows applications five times faster while writing less code. It supports you through the full development lifecycle to deliver a single-source code base that you simply recompile and redeploy. Featuring an enhanced Clang-based compiler, Dyncomware STL, and packages like Boost and SDL2 in C++ Builder's Package Manager, and many more. Integrate with continuous build configurations quickly with MSBuild, CMake, and Ninja Support either as a lone developer or as part of a team. Connect natively to almost
Starting point is 00:28:39 20 databases like MariaDB, Oracle, SQL Server, Postgres, and more, with FireDAC's high-speed direct access. The key value is C++ Builder's frameworks, powerful libraries that do more than other C++ tools. This includes the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey framework for cross-platform UIs. Smart developers and agile software teams write better code faster using modern OOP practices and C++ Build builders' robust frameworks and feature-rich IDE.
Starting point is 00:29:09 Test drive the latest version at Embarcadero.com. Can we talk a little bit about how it compares to the other C++ binding generator, Swig? You mentioned that there's interface definition files, which I believe is how Swig works. How do those compare? Is Gini, in your opinion, easier to work with compared to Swig? I cannot say easier to work with
Starting point is 00:29:36 than Swig because I don't know so much about Swig. I know Swig is, Jason, I have heard you used it in real world. Yeah, I've been using Swig for like 15 years now. If there's a good alternative, I would heard you used it in real world. Yeah, I've been using Swig for like 15 years now. And if there's a good alternative, I would strongly consider it. Yeah. So I mean, the first difference is, of course,
Starting point is 00:29:52 I don't think Swig interfaces generate stuff for Objective-C. So this is the first reason. The other thing is, as I said, Gini starts with interface definition language and the file. And I like this approach a lot. Here is a header file, please generate a binding. What you can do with it. Because the interface definition file is like a contract with you and the other components.
Starting point is 00:30:21 And this is also why I like Protobuffer, for example, where you have a contract. This is our contract, how we communicate with each other. This can be messages in the case of protobuffer where you have a file or with Gini you have this interface file. And it's the interface definition language is simple but very powerful. So it supports enums, then enum class for bit stuff in enums it supports records where you say these are structs or value types so they are passed in by value and interface which are what you expect from from from
Starting point is 00:31:00 a Python or Java object that you get, you always pass a reference, which is implemented under the hood as a shared pointer. And that's basically it. So everything happens in these entities. And it supports, of course, the basic data types. Then you have support for a list, a map, string, and binary data out of the box. But there is also something that is
Starting point is 00:31:27 where you can define data types with Yammer, and then you can add additional types that you don't define in Gini, but you get from somewhere else, which is a pretty advanced topic and interesting. I haven't used this so far, but I know Johannes has. So from this, it's a very simple interface definition language, but very powerful that supports ideas like
Starting point is 00:31:53 the enum and here is a value type and here is the shared pointer type or the reference type. And this is basically, and I don't know if there are so many other alternatives to to this week yeah i think it sounds like it's pretty much a swag yeah yeah so there is let me let me think i mean there there is there is a commercial project called scapix.com s-c-a-p-i-x dot com and they also would interface with mobile platforms but they have a custom license or it's actually basically one person so this is more like you generate
Starting point is 00:32:35 your header files and then you generate the glue code from the header files that you have but with this project I went there so it's a single person project and it has a custom license. And when it's a project, it has a custom license, and it says you can use it if you obey the license, and so, oh my god,
Starting point is 00:32:51 I don't know, right? So actually, I cannot say if there are many more other alternatives, other than providing a C interface and using the FFI that you have in various languages to communicate with the C++ we are C interface with. That actually just raises an interesting question
Starting point is 00:33:12 because I feel like I must be remembering an alternate universe or something because I swear at one time Swig supported a C as a target language. So you could just generate bindings for use from C for your C++ library. But I could not find that when I was just looking at Swig like a week ago, and it made me wonder
Starting point is 00:33:32 if Genie could be used in that way. This is why the Python bindings have been so interesting for us because the Python bindings go via C interface. Right. And also basically the Java also, go via a C interface. Right. And also basically the Java also, but in a little bit different way. So you can look now at
Starting point is 00:33:51 this actually and say, okay, what is if we say we want to generate based on the interface definition language that we provide, what can we do to have a C interface that is more generalized not not tailored for for for python so this is why this has been so so interesting for us to get in to have a example
Starting point is 00:34:13 and maybe someone will look at this in in some future if there is more time so yeah and then then there is of course the there is of course course always the question is how do you convert C++ specific types? Like it is very obvious to go from a vector to an NS array in Objective-C or what is Java list? I wouldn't have to look it up. And things like this. So this needs to be handcrafted maybe a little bit always from what the target language provides and how this is implemented in the target language.
Starting point is 00:34:58 But yeah, there is a C interface already today. So you said vector can be shared currently with Java and Objective-C? Yes. And what about string? I think you mentioned string as well. Strings are there. So a vector is an array list in Java, and then there's an array in Objective-C, and a list in Python,
Starting point is 00:35:22 and systemCollection.Generics.List in C Sharp. And then you have an unordered set in C++ becomes a hash set in Java, and a set in Objective-C, a set in Python, and a system collection generic hash set in C sharp. And an unordered map in C++ becomes a hash map in Java, and a dictionary in Objective-C, and a dictionary in Python, and a system collection generic dictionary in Objective-C and the dictionary in Python and the system collection generic dictionary in C Sharp. So these mappings and there is also a datetime which is
Starting point is 00:35:51 chronosystemclock time point and becomes nsdate or datetime in Python and systemdate in C Sharp. So there are these mappings that need a little bit extra love for each
Starting point is 00:36:08 language to implement them. But this is the nice convenience of the Genie interface. You have these types out of the box and you're very much in C++ land and don't need to care so much about what the other
Starting point is 00:36:23 language supports because this is generated for you and it is there. And the way how it works is that you generate your interface definition file, you run the Genie generator, it generates a bunch of base classes that you implement. And then you need, if you have, for the interface types, you need to add static functions, because there are no free functions there. If you need a free function to generate,
Starting point is 00:36:53 to create something, you do a static create the interface you are actually in, and you implement the discrete function. So if I want to instantiate my own templates in Genie, like I want, you say I can support map and vector. If I said, well, if I want a map of strings to vectors events, is that something that Genie can handle? I'm not sure if, I don't want to answer this
Starting point is 00:37:21 because I'm not sure. I would imagine it can handle a little bit because it translates the type, but you need to test this. Actually, if you want a vector of vector of maps of whatever. Right. If not, add a thrilling test case and we can look at it if it's required.
Starting point is 00:37:43 I feel like my experience, like I said, it's been like 15 years I've been doing cross-language development of some sort. As long as you can support something like a vector of strings, then you can get everything that you need eventually. It might take a little bit more working around the system if you need to, but whatever. Okay. And we have, since recently, a small example application in the GitHub organization,
Starting point is 00:38:15 which is just the X1 interface definition file. It has a CMake file that uses Conan to get the generator and the support lib. By the way, we just released the version 1.0.0 from both the generator and the support clip not because we think it's so stable because it's as stable as it always was we haven't changed that much from the from the generator and the support lip but we feel now comfortable with our infrastructure, with the GitHub organization, the CI, and so on, that we say, okay, actually, we take this code, this works good for a lot of people. And we started with 0.0.1 version, right? I said, okay, now this restructuring of the project, this works good and we can also distribute the generator and the support lib so you can use it
Starting point is 00:39:09 via Conan. The sample project in the GitHub organization does this. Then it has a little bit of a new method, CMake, how you utilize the generator from CMake that it processed the interface definition file. When you change the interface definition file, it will regenerate the code. And then it shows also how to run C++ unit test, Objective-C unit test, Swift unit test, Java unit tests from within CMake. So the basic idea why I do this is that, when you want to deliver this,
Starting point is 00:39:42 you want to deliver it as a component for the language. And this means you should have the unit tests you have as close as possible in your project. So when you make a component, a library, a package, framework, whatever, with the interface, you have a bunch of unit tests in the target language. And in your project, you run all this stuff via CMake target test and it will execute in UCI and test the library from the target language and then you can take what has been generated and pass on to consume it to the project. And this is on a very early stage a little bit the example but it's already working and I have plans to extend it a little bit and create a tutorial
Starting point is 00:40:25 around this to have a simple intro into Hello World for running C++ on Android or iOS or both because even if it's technically if you have all the pieces together it's complicated because it's a lot of different small pieces that need to play together. So what makes it complicated is all the different pieces you need together and how Android expects to be a package that you can consume and how iOS expects a framework that you can consume from iOS and put on the device with your application and so on. So this part is getting these parts correct is hard. The single step, each one step is not terribly complicated,
Starting point is 00:41:13 but putting them all together is quite some steps that I would like to showcase over time in this example project. That's, I mean, just even taking the mobile platforms out of the picture. Just yesterday, I was actually writing some unit tests for some Python bindings that were generated by Swig. And just to get all of the, to get everything all lined up so that it works so that you know which version of Python you want to use for your test, and then to make sure that your test
Starting point is 00:41:49 knows how to find the Python library that you just compiled so that you can actually load that module and run your test. It's, you know, more difficult than it should be, so I'm really happy to hear that you are working on, you know, examples and tests that show how to do that kind of thing as well. have currently unfortunately python not on the list so the tests are currently
Starting point is 00:42:10 objective c and java but but still same idea yeah python would you want also hello world you copy from and start and yes this python is is there are multiple ways of having Python on your system. And say, okay, I want this Python version. You can virtual environments. You can use the ISDF version manager to get it. You can use DRAM on Linux or Mac OS. So, yeah, this is... But having that kind of example for people to go and look at,
Starting point is 00:42:45 even if you don't have a Python one yet, it sounds great. Yeah. I mean, we built tests for the support lib, and this builds on the CI. So you can look at the CI and the GitHub action, what it's actually doing. But this is not very accessible to say, hey, to new users who say, hey, I would like to do this.
Starting point is 00:43:05 Yeah, look at the CI. This is not a nice intro for the hell of a lot. Yeah, that's almost an RTFM kind of answer back, I think. Yeah. Look at the CI. Yeah. If you have a library that you want to bring on and make an Android or iOS application using it, how hard is it to write these interface definition files that Ginny works with? Well, absolutely not hard. It is, as I said, you can look at the documentation for the interface definition language.
Starting point is 00:43:42 It is basically what it is, Inam, then it's Inam, flex, then it's Inam-Grass, the records becomes a struct, and interface becomes a Grass in C++. And there you're putting simply your properties and the type, so name, column, type, semicolumn.
Starting point is 00:44:08 You can add Doxygen documentation into the interface definition. This will be transferred into the generated files. So you will have it available from Java, Objective-C and C++. Yes, I said the guys at Dropbox did awesome work. So this is a really, really good project. I should maybe mention that Generator itself is written in Scala. So, yeah, but if you know what Ruby is,
Starting point is 00:44:33 then Scala is not that... It will at least look familiar. I was also so... When I looked at it, it's Scala. Oh, I'm scared, right? Then I looked at it and said, oh, this looks like Ruby. I can't handle it. So then... and and yeah and i said this this is pretty stable what what it does so the processing of the interface uh files and the generation of the glue code
Starting point is 00:44:58 and this this is pretty stable so there is nothing to do and if you add new languages then of course it will be like the biden and the sharp. We depend a little bit on users, right? To give feedback because you can test some things, but at the end you always need someone else who uses the thing in a total different way and says, this is crap. This doesn't work at all. Right. And then, okay, can we find out why? And then you build up on this, right? So because that's how it is. And from this aspect, we rely a little bit on this. But it is also very interesting. So you have all these different languages.
Starting point is 00:45:33 You can work with all these different languages. You can work with Scala. There is the support part. There is the generator part. There is the documentation. I think Johannes Kraft, he made such a wonderful documentation. If you look at the webpage, I'm so enthusiastic about this because normally documentation is a little bit neglected in a project, right?
Starting point is 00:45:53 But this is really beautiful and well made. So it takes all the Markdown files from the different projects. So you put the bare project documentation in the project repository. And then there is this master repository that takes all these Markdown files and generates HTML documentation and publishes it as GitHub pages. And it looks good. It has tag theme support. So this is really, I like it. Yeah. So we talked a bit about, you know, some of the new things that have been added, the Python and the C Sharp support.
Starting point is 00:46:28 Is there anything you have like future plans or something you're hoping will get worked on? Like in the queue, are you looking for more contributors? Yes, always, of course. And people are using it. So if you use the Dropboxbox genie then you can go on the fly it is a drop-in replacement um we had a little bit of breaking change but you can turn it off but the breaking change we have make your life easier because the one of the thing is when you
Starting point is 00:46:57 create the java library you need to have a on when you load the library uh you need to set up Genie. And you needed to write this code so far by hand. Now it's auto-generated for you. And if you have already this code, then you will have the same functions defined two times if you generate it. But you can either turn it off or just use the existing one. Otherwise, we have just a few fixes. It shouldn't break anything for you. So you can drop in replace it with
Starting point is 00:47:25 the cross-language CPP genie. Then of course improvements. If users have bugs then please report them. We will fix them if possible. The new languages of course need users and we need way more feedback. My personal goal is of course to keep the project as a community project, so not having a bus factor of one, so
Starting point is 00:47:51 having multiple maintainers so that this project can always proceed and pull requests can be reviewed. Making an open environment that is actually I mean, we don't have very strong rules. When you contribute, you need to obey whatever and so on, right?
Starting point is 00:48:12 This is not the case. We try to make... If you contribute something, you're the owner of the code for a while. But I know it's an open source project, so people will come and leave. So the only thing is it should be maintainable and readable. But as long as it is we're open for for everything i personally want to to to work as time allows it on assets uh the documentation and tutorial how to use it to make the whole topic more accessible and have a example how you get uh c++ into ios sub or Android app that it becomes basically
Starting point is 00:48:47 okay I have this template a hello world and can build based on this one this is my personal goal and then I said that the rest I know there are people that have Node.js bindings written there are a lot of people that have their personal fork of genie and some of of them said, oh, yeah, we have this Node. One person I know has this Node.js implementation. So you can go to JavaScript. Yeah, but it's not beautiful. I cannot share it, right?
Starting point is 00:49:15 But I would encourage people to just open a pull request. And if it's not beautiful, maybe someone else will say, oh, I have also Node.js backlinks. Because there are a lot of forks from from Gini and especially when it was made read-only people have implemented the changes down so what I want to have is this as I want to focus also a little bit on the community aspect keeping the community alive and welcoming and say okay if, if we have an improvement, please submit it to us and we will put it in. And then this is a code that does not rot.
Starting point is 00:49:52 And it looks right now, if you were to search for C++ Genie, you're going to find the drop box first. That's going to come up on the top link, which says this project has been archived. So what is the, you've said you've created a github organization but i don't know if you said the name so go ahead and tell the listeners where to go to if they want the latest and greatest one yes so this is this the the organization is cross minus language minus cpp on github okay so this this is pretty long, but I think this is a good name. The documentation page is a little bit shorter.
Starting point is 00:50:28 It's genie.xlcpp.dev. And this is basically the best entry point. Okay. Because the documentation gives you then the link also to the GitHub repository. There is also still a Slack channel and Dropbox created back in the days where you can invite yourself
Starting point is 00:50:47 to mobile development for Slack. And there is also a Slack channel on CppLang. Which is dedicated for mobile development. But for the Slack, there is also the mobile Cpp Slack which is dedicated
Starting point is 00:51:03 to mobile development. So, yeah, I'm not sure what we could do to make us better findable. It would be nice if... It would help a little bit. And if you know someone at the Genie organization, one of the original, or someone at the Dropbox organization,
Starting point is 00:51:22 if they could put a link, say, this organization has continued. I don't think they can do this because they have to. I mean, I have also forgotten there is the one person, let me look up the name that I don't say it wrong, but I will say it. I think I will say it's wrong in any way. So Artur, he's from the original Dropbox team, and he is still on the Slack and helped us a little
Starting point is 00:51:49 bit with what he remembered about the Biden binding for example. But he has his email address run on the Dropbox readme and not even this could have been fixed. So I don't think that Dropbox can or will fix anything for us. Okay. That's too bad. Yeah. It's funny because every time I log into GitHub lately, I get a notification from GitHub asking me if I...
Starting point is 00:52:18 Just a name to get it right. Andrew Twyman. Not Arthur. Andrew Twyman. So people that wrote a mail on him based on the email in the original Dropbox, if it didn't get the answer, then because the mail went to the wrong address. Okay. Well, Harold, it's been great having you on the show today.
Starting point is 00:52:39 Thank you so much for telling us about the latest with Ginny. I'm glad it's still actively being developed. I'm going to go take another look at it myself. Yeah, please do this. Anything else you want to plug before we let you go? Yes, of course, C++ user groups. Currently, there is, of course, a little bit of break in the C++ user group,
Starting point is 00:53:01 but I think every week we all can see light at the end of the tunnel that physical meetups will be possible again. I mean, there's a lot going on virtual. C++ user groups are living from the community, so please get in contact with them.
Starting point is 00:53:16 If anyone comes ever to Stockholm and wants to visit a meetup or speak at a meetup, just contact me. Then we can arrange something I'm always looking for speakers we do the videos on our YouTube channel YouTube's less sweet CPP and there is a swing CPP dot se for Sweden homepage which lists all C++ meetups that currently happen worldwide so you have a
Starting point is 00:53:44 link to worldwide and you get all the meetups and most are currently virtual so you can access them and it has also a video feed where C++ related videos are shown and a blog feed where I think nearly 50 blog sources are there. So you can go there and yeah, this is also maybe if you want greater as a community, there is a organization called CPP comm,
Starting point is 00:54:15 which is very likely in the name like CPP con and it's not the accident because junk help actually created this and it's a Jason, you should actually be there because you're running a meetup group. And last year we had every month or so we met organizers around the world talking a little bit how it is to run a meetup group
Starting point is 00:54:36 and discussing things about this, but also for event organizers. And there is material available when you want to start a user group. There is a starter kit with information how you can do this, what to do, also for a conference, and you can find this on cpp.com.org. Yeah, and this is the community aspect
Starting point is 00:55:01 I would like to mention. Okay, well, Harald, it's been great having you on the show today. Yeah, thanks for having me. It was great to talk with you. Thanks for coming on. Thanks so much for listening in as we chat about C++. We'd love to hear what you think of the podcast. Please let us know if we're discussing the stuff you're interested in, or if you have a suggestion for a topic, we'd love to hear about that too.
Starting point is 00:55:22 You can email all your thoughts to feedback at cppcast.com. We'd also appreciate if you can like CppCast on Facebook and follow CppCast on Twitter. You can also follow me at Rob W. Irving and Jason at Lefticus on Twitter. We'd also like to thank all our patrons who help support the show through Patreon. If you'd like to support us on Patreon, you can do so at patreon.com slash cppcast. And of course, you can find all that info and the show notes on the podcast website at cppcast.com. Theme music for this episode is provided by podcastthemes.com.

There aren't comments yet for this episode. Click on any sentence in the transcript to leave a comment.