Question over C++ to D conversion
Mike Franklin
slavo5150 at yahoo.com
Mon Mar 12 02:45:35 UTC 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/2587
I'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
More information about the Digitalmars-d
mailing list