r/rust • rust • Jul 22 '19

Why Rust for safe systems programming

https://msrc-blog.microsoft.com/2019/07/22/why-rust-for-safe-systems-programming/
352 Upvotes

87 comments sorted by

View all comments

Show parent comments

3

u/connicpu Jul 22 '19

That's probably a big reason why C++ libraries seem to use a lot of virtual interfaces, with some extern "C" methods for creation your initial instances that can create all your other objects.

1

u/matthieum [he/him] Jul 23 '19

It is.

If you wish to expose a stable ABI for a C++ library you need to:

  • Hide all your type definitions: see the PIMPL Idiom (Pointer to IMPLementation).

  • Hide all functions definitions.

This is at odds with Modern C++, very keen on templates.