Skip to content
0:00 / 0:00

#ffi#unsaferust#cwrappers

RustFest Zürich 2017 - Mistakes to avoid when writing a wrapper around a C library by Pierre Krieger

Rust Programming Language

70K subscribers • 72 videos on Hallway • Conference channel

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • Presented by Pierre Krieger

Intermediate. Assumes working knowledge.

1.9K views8 years ago2 recommendations

Programming languagesSystems programmingRustCMemory management

Pierre Krieger outlines common safety pitfalls, API design mistakes, and memory leak issues when writing Rust wrappers around C libraries.

Do you need to perform a certain task in Rust? Why not pick a mature C library that already does what you want, and write a wrapping library around it? Writing a wrapping library is sometimes not as easy as one could think, and you will probably make mistakes that will make you lose time or even make your wrapper unsound. This talk will show you the most common safety problems you may not have thought of, such as leak safety, but will also give you advices on what not to do when designing the API of your library. About Pierre Krieger: After coding in C++ for about ten years, Pierre switched to Rust in 2014 and has been maintaining several game-development-related libraries. He specializes in graphics programming.

Why it's here

2 people recommend this

What people say. Recommended as an essential talk on the difficulties and safety assumptions of writing unsafe Rust wrappers.

Moments people linked to

u/Xanewokrlsin r/rust • Recommends

On “[GOOGLING HELP WANTED] Trying to find that cool talk about things you can't assume when writing unsafe code”

I think you want /u/tomaka17's "Mistakes to avoid when writing a wrapper around a C library" talk from RustFest Zurich: [video (coin flip example)
19View on Reddit

u/awilixin r/rust • Recommends

On “Introducing cHTTP; or, Why Pure Rust Is Not A Worthy Goal”

I recently saw a pretty good talk about this: link to this video I never realized it was so difficult!