Тёмный

Rust FFI: Microsoft Flight Simulator SDK Part 1 

Ryan Levick
Подписаться 14 тыс.
Просмотров 10 тыс.
50% 1

Опубликовано:

 

27 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 16   
@damonpalovaara4211
@damonpalovaara4211 3 года назад
1:08:50 If you're making a safe wrapper for c/c++ library bindings you should abstract away from using c types. I believe it'd be more idiomatic to pass in a regular String and convert it to what you need inside of the new method so the user doesn't have to think about using types that they aren't used to.
@joeblack375
@joeblack375 4 года назад
A few things I noticed: - 0 being equivalent to NULL is not a Windows thing, but a C++ thing. NULL was *required* to be defined as 0 (unlike C which *may* also define NULL as (void*)0) until C++11 which introduces nullptr, which has the advantage of disallowing silently interpreting 0 as a null pointer. Also helps in avoiding calling the wrong overload. - HRESULT can be non-zero but successful. Only negative HRESULT values indicate failure, which is why the C++ code used the SUCCEEDED macro. - For string constants you can use std::ffi::CStr::from_bytes_with_nul to avoid an allocation just to add a null byte (albeit requiring you to explicitly pass a \0-terminated byte-string)
@Roms8313
@Roms8313 Год назад
that's literally the learning material I've been looking for ages, thanks so much Ryan! the pace of the video is just perfect :)
@pictureus
@pictureus 4 года назад
Thank you for this Ryan :) Hope you continue with these kinds of videos.
@mottosson
@mottosson 4 года назад
Love the "successful compilation"-cheers 😁 Great stream, looking forward to the next!
@retronexusnet
@retronexusnet Год назад
Fantastic! Thank you! Are you planning to do more MSFS tutorials?
@fnizzelwhoop
@fnizzelwhoop 4 года назад
I'm pretty sure that the Win32 Sleep() call waits in milliseconds, not seconds. That's why there was such a delay between you hitting the brake and the event triggering.
@bestformspielt
@bestformspielt 3 года назад
I like how you adjusted to using the term "allowlist" :)
@MihaiDinculescu
@MihaiDinculescu 4 года назад
Great stuff! I hope that you'll do a part 2 soon!
@damonpalovaara4211
@damonpalovaara4211 3 года назад
1:03:30 I like the using match blocks when there is a conditional return since it looks cleaner: match hr { 0 => Ok(Self { handle }), _ => Err(hr) }
@fnizzelwhoop
@fnizzelwhoop 4 года назад
Also, I vote for a part two of this. 👍
@jeffg4686
@jeffg4686 3 года назад
Great video. Thanks for share.
@Matteinko
@Matteinko 4 года назад
Good video!
@eternalkun
@eternalkun 4 года назад
The name pointer is dangling after SimConnect::new(). I haven't been able to find any documentation on the required lifetime of the pointer, so I can't say for sure, but this definitely smells of unsoundness.
@RyanLevicksVideos
@RyanLevicksVideos 4 года назад
I also couldn't find any docs on the expected lifetime of this pointer but it _seems_ like MapClientEventToSimEvent does not assume the pointer lives longer than the function call.
Далее
Rust FFI: Microsoft Flight Simulator SDK Part 2
1:33:13
Просмотров 3,3 тыс.
AI Plays Minecraft Forever (and dies)
23:22
Просмотров 450 тыс.
Bruce has suddenly passed away.
22:45
Просмотров 292 тыс.
Buying a Brand New PC is Dumb...
17:01
Просмотров 1,2 млн
Coding a Web Server in 25 Lines - Computerphile
17:49
Просмотров 341 тыс.
How do Graphics Cards Work?  Exploring GPU Architecture
28:30
Игровые Истории / Булджать
22:57
Просмотров 784 тыс.