• 5C5C5C@programming.dev
    link
    fedilink
    arrow-up
    2
    ·
    2 months ago

    This makes a lot of sense, but the functions were Rust bindings for plain C functions, they weren’t function pointers. Granted I could have put pointers to the function bindings into fields in a struct and stored that struct in the mutex, but the ability to anyhow call the bindings would still exist.

    • SorteKaninA
      link
      fedilink
      arrow-up
      1
      ·
      2 months ago

      They were also plain C functions in my case, but it doesn’t take too much discipline to only call it through the struct. Also, you can put the struct in a different crate which includes the C bindings to ensure that you can’t call the C bindings without the struct.