# SDL3 main callbacks with rust bindgen

**URL:** <https://discourse.libsdl.org/t/sdl3-main-callbacks-with-rust-bindgen/59537>\
**Category:** Game Development\
**Created:** [May 4, 2025, 10:03pm UTC](https://discourse.libsdl.org/t/sdl3-main-callbacks-with-rust-bindgen/59537 "2025-05-04T22:03:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![exaulo](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/e/b9e5f3/32.png) [@exaulo](https://discourse.libsdl.org/u/exaulo)\
**Post date:** [May 4, 2025, 10:03pm UTC](https://discourse.libsdl.org/t/sdl3-main-callbacks-with-rust-bindgen/59537/1 "2025-05-04T22:03:31Z")

</div>

I have a very basic rust project using [rust-bindgen](https://github.com/rust-lang/rust-bindgen) to generate SDL3 rust bindings, everything good and basically mapped 1:1 from SDL C examples to rust except the [main callbacks](https://wiki.libsdl.org/SDL3/README/main-functions#how-to-use-main-callbacks-in-sdl3), seems the trick requires more than enabling SDL\_MAIN\_USE\_CALLBACKS in bindgen wrapper.h

For some reasons there seem there is an entry point barrier to understand how this callback mechanism works in foreign languages like rust

Is it required to mark a function with a decorator besides being extern “C” ?

I’m also aware there is a sdl3\_main crate. however that crate took a different approach by rejecting rust bindgen entirely and using it’s own binding generator
