# Interfacing D to Legacy C++ Code: A summary of a competing language's capabilities

**URL:** <https://internals.rust-lang.org/t/interfacing-d-to-legacy-c-code-a-summary-of-a-competing-languages-capabilities/1406>\
**Category:** ideas (deprecated)\
**Created:** [January 23, 2015, 2:31pm UTC](https://internals.rust-lang.org/t/interfacing-d-to-legacy-c-code-a-summary-of-a-competing-languages-capabilities/1406 "2015-01-23T14:31:47Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![pcwalton](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/pcwalton/32/207_2.png) [@pcwalton](https://internals.rust-lang.org/u/pcwalton)\
**Post date:** [January 23, 2015, 6:26pm UTC](https://internals.rust-lang.org/t/interfacing-d-to-legacy-c-code-a-summary-of-a-competing-languages-capabilities/1406/3 "2015-01-23T18:26:14Z")

</div>

Templates are going to be pretty hard, because C++ templates (like D’s, Nim’s, etc.) are all ad-hoc rather than strongly typed (based on typeclasses) as in Rust. But you might be able to do the same trick whereby you convert templates into generics and then specify how to do the name mangling, at least for a “well-typed” subset of templates. I dunno how much existing C++ code could actually be made to fit into Rust’s trait system.

---

_[View the full topic](https://internals.rust-lang.org/t/interfacing-d-to-legacy-c-code-a-summary-of-a-competing-languages-capabilities/1406)._
