Michael-F-Bryan / rust-ffi-guide

A guide for doing FFI using Rust
https://michael-f-bryan.github.io/rust-ffi-guide/
Creative Commons Zero v1.0 Universal
282 stars 18 forks source link

Revised tutorial #41

Closed Michael-F-Bryan closed 6 years ago

Michael-F-Bryan commented 6 years ago

This is a revised tutorial written from the perspective of someone wanting to create a basic REST client which uses Qt for the GUI and Rust for the business logic.

(rendered)

(fixes #40)

Michael-F-Bryan commented 6 years ago

Hm, it might be fun not to include this line at first and show how a linking error looks like...

@matklad, this actually got me thinking... I've added a new section to the very end where we try to go through all the possible ways to cause undefined behaviour, memory bugs, compile/linker errors, data races, and all that fun stuff.

It's written as a problem set which the reader is meant to try and solve, with solutions where we explain why that particular example isn't a good idea. If you can think of some fun examples which abuse unsafe feel free to mention them as a comment.

Michael-F-Bryan commented 6 years ago

I believe this is at the point where we should start to think about merging it into the master branch. That way, even though it's a work-in-progress, a large chunk of the guide is written and people can start benefiting from it.

Once CI passes I think I'll merge it and then create a bunch of issues in the issue tracker to flesh out the remaining TODOs.

matklad commented 6 years ago

Looks like https://michael-f-bryan.github.io/rust-ffi-guide/ is still pointing to the old tutorial, is that expected? Otherwise, this is looking really-really great!

Michael-F-Bryan commented 6 years ago

The deploy stage probably failed. It's only set to fire on a commit to master, and because everything's changed it hasn't been tested up until I hit the "merge" button.

Michael-F-Bryan commented 6 years ago

Fixed it. I'm using a docker image to run the compile, test, and deploy stages and it only passes through environment variables you've explicitly specified. So when it tried to push to github pages it'd you'd get errors like repository 'https://@github.com/.git/' not found.