digitalmars.D - Question over C++ to D conversion
- Richard (46/46) Mar 11 2018 Hi,
- Mike Parker (4/6) Mar 11 2018 If you have access to a Windows box, this might help get you
- Mike Franklin (25/36) Mar 11 2018 I'm hoping for that to land soon as well. The minimal runtime
- Laeeth Isharc (7/13) Mar 11 2018 See Gooberman fork of binderoo. It only worked on Windows and X
- jmh530 (3/6) Mar 11 2018 I think I saw a reference to this somewhere else. Sounds pretty
- Richard (4/10) May 15 2018 This might be it
- Filipe =?UTF-8?B?TGHDrW5z?= (4/15) May 15 2018 Are you aware of DStep? It has been working great for me. The
- Filipe =?UTF-8?B?TGHDrW5z?= (2/18) May 15 2018 Oh sorry, my mistake. I missed your link above.
- Johan Engelen (6/14) May 15 2018 Have you tried with LDC 1.9.0? (dlang 2.079)
Hi, I'm sure this question has been asked a few times before But I'm currently looking at something that will convert Cpp code to D I've recently setup a proof of concept demo which uses mbed for an embedded LPC1769 Arm board This is just a test, but I've recently managed to get debugging working across both C and D files at the same time. This means single stepping code on a remotely attached Arm board in VSCode, while being able to inspect registers with an svd file https://github.com/grbd/GBD.Dlang.MbedBlinkyTest There's a couple of outstanding things at the moment though The first is the use of BetterC, although from what I can tell DMD now has support for a minimal runtime feature as part of 2.079.0 https://dlang.org/changelog/2.079.0.html#minimal_runtime so hopefully when this makes it's way into LDC I can then make use of it for an Arm MCU for creating class's without the full runtime. https://github.com/ldc-developers/ldc/pull/2587 These were also mentioned in a separate thread. * https://bitbucket.org/timosi/minlibd * https://github.com/JinShil/stm32f42_discovery_demo * https://github.com/kubo39/stm32f407discovery The second is that mbed uses C++ class's for it's API most of this is just headers such as DigitalOut.h https://github.com/ARMmbed/mbed-os/blob/master/drivers/DigitalOut.h So ideally I've been looking for something that can translate those headers into Dlang so they can be used there instead. * The first two utils I've found were DStep and htod, however they seem to only hand C https://github.com/jacob-carlborg/dstep * I discovered some examples of libraries over here https://github.com/D-Programming-Deimos * There's CPP2D but the last update was around 2016 https://github.com/lhamot/CPP2D * Calypso seems to be a Fork of LDC, but I think it might be a while before 2.079.0 makes it in. https://github.com/Syniurge/Calypso One possibility I might look into is a D backend for CppSharp * https://github.com/mono/CppSharp I was wondering if there are any other ways that are known about for translating C++ into D, or accessing C++ libraries. Many Thanks Richard
Mar 11 2018
On Monday, 12 March 2018 at 01:10:41 UTC, Richard wrote:I was wondering if there are any other ways that are known about for translating C++ into D, or accessing C++ libraries.If you have access to a Windows box, this might help get you there: http://rainers.github.io/visuald/visuald/CppConversion.html
Mar 11 2018
On Monday, 12 March 2018 at 01:10:41 UTC, Richard wrote:There's a couple of outstanding things at the moment though The first is the use of BetterC, although from what I can tell DMD now has support for a minimal runtime feature as part of 2.079.0 https://dlang.org/changelog/2.079.0.html#minimal_runtime so hopefully when this makes it's way into LDC I can then make use of it for an Arm MCU for creating class's without the full runtime. https://github.com/ldc-developers/ldc/pull/2587I'm hoping for that to land soon as well. The minimal runtime features and -betterC do have some overlap, but there are some specific things -betterC does that the minimal runtime doesn't do. See https://dlang.org/spec/betterc.html. At least one such feature is "assert failures are directed to the C runtime library". The minimal runtime has uses for those wishing to port the druntime to a new platform or architecture and do so incrementally. It's also useful for those that may choose to implement minimal subset of runtime features or provide an alternate implementation of a runtime feature for their application. This is especially useful in the embedded domain where there is typically one process running, and you know upfront what features you will need or not need; and you won't have to do the work of porting everything just to get a build. -betterC, on the other hand, is somewhat of a blunt instrument, and removes certain features of the runtime wholesale. With the minimal runtime features, you will be able to create a betterC-like application by simply avoiding features that you haven not implemented in your port of the runtime. That wasn't possible prior to 2.079.0.I was wondering if there are any other ways that are known about for translating C++ into D, or accessing C++ libraries.I'm sorry I don't know of any reliable tool that can create bindings to C++ libraries automatically. Mike
Mar 11 2018
On Monday, 12 March 2018 at 01:10:41 UTC, Richard wrote:The second is that mbed uses C++ class's for it's API most of this is just headers such I was wondering if there are any other ways that are known about for translating C++ into D, or accessing C++ libraries. Many Thanks RichardSee Gooberman fork of binderoo. It only worked on Windows and X Box before, but now it should work on Linux. That's for C++ For conversion of C headers, watch this space. C first, C++ eventually. Might be a talk at Dconf on it. Also see the tool in Visual D, which I haven't yet used myself.
Mar 11 2018
On Monday, 12 March 2018 at 02:48:17 UTC, Laeeth Isharc wrote:[snip] For conversion of C headers, watch this space. C first, C++ eventually. Might be a talk at Dconf on it.I think I saw a reference to this somewhere else. Sounds pretty darn cool.
Mar 11 2018
On Monday, 12 March 2018 at 03:42:41 UTC, jmh530 wrote:On Monday, 12 March 2018 at 02:48:17 UTC, Laeeth Isharc wrote:This might be it https://github.com/atilaneves/dpp I noticed it mentioned on the online DConf 2018 youtube video[snip] For conversion of C headers, watch this space. C first, C++ eventually. Might be a talk at Dconf on it.I think I saw a reference to this somewhere else. Sounds pretty darn cool.
May 15 2018
On Tuesday, 15 May 2018 at 21:00:25 UTC, Richard wrote:On Monday, 12 March 2018 at 03:42:41 UTC, jmh530 wrote:Are you aware of DStep? It has been working great for me. The only downside is that it doesn't do C++ at all :/ . https://github.com/jacob-carlborg/dstepOn Monday, 12 March 2018 at 02:48:17 UTC, Laeeth Isharc wrote:This might be it https://github.com/atilaneves/dpp I noticed it mentioned on the online DConf 2018 youtube video[snip] For conversion of C headers, watch this space. C first, C++ eventually. Might be a talk at Dconf on it.I think I saw a reference to this somewhere else. Sounds pretty darn cool.
May 15 2018
On Tuesday, 15 May 2018 at 22:07:02 UTC, Filipe LaĆns wrote:On Tuesday, 15 May 2018 at 21:00:25 UTC, Richard wrote:Oh sorry, my mistake. I missed your link above.On Monday, 12 March 2018 at 03:42:41 UTC, jmh530 wrote:Are you aware of DStep? It has been working great for me. The only downside is that it doesn't do C++ at all :/ . https://github.com/jacob-carlborg/dstepOn Monday, 12 March 2018 at 02:48:17 UTC, Laeeth Isharc wrote:This might be it https://github.com/atilaneves/dpp I noticed it mentioned on the online DConf 2018 youtube video[snip] For conversion of C headers, watch this space. C first, C++ eventually. Might be a talk at Dconf on it.I think I saw a reference to this somewhere else. Sounds pretty darn cool.
May 15 2018
On Monday, 12 March 2018 at 01:10:41 UTC, Richard wrote:The first is the use of BetterC, although from what I can tell DMD now has support for a minimal runtime feature as part of 2.079.0 https://dlang.org/changelog/2.079.0.html#minimal_runtime so hopefully when this makes it's way into LDC I can then make use of it for an Arm MCU for creating class's without the full runtime.Have you tried with LDC 1.9.0? (dlang 2.079) Would be very interesting to hear about your experiences in trying to put together / use a minimal runtime. Cheers, Johan
May 15 2018