Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Mistakes to Avoid When Writing a Wrapper Around a C Library

Rust via YouTube

Overview

Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Discover common pitfalls and best practices for creating Rust wrappers around C libraries in this 35-minute conference talk from RustFest Zürich 2017. Explore safety issues like leak safety, API design considerations, and implementation challenges. Learn how to avoid transmuting tuples, handle hidden global variables, and properly implement lock APIs. Gain insights on testing strategies, memory layout assumptions, and dealing with Rust panics. Benefit from Pierre Krieger's expertise in graphics programming and game development as he shares valuable lessons for creating robust and efficient Rust wrappers for C libraries.

Syllabus

Intro
What is a wrapper
Not catching rust panics
Not testing on a large scale
Assuming a certain layout
Transmute tuples
Highlevel abstraction
When to view
Lock API
How to fix this
Mistake 4 Hidden global variables
New text mutex
Why it doesnt work
Conclusion
Read primitives from memory
Mistake 2 assuming threat implementations are bugfree
The problem
Why would someone do this
How to solve this
Other examples
Mistake 1 API related
Mistake 2 API related
Conclusions
Question

Taught by

Rust

Reviews

Start your review of Mistakes to Avoid When Writing a Wrapper Around a C Library

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.