16 releases

0.4.11 Oct 26, 2024
0.4.9 Sep 8, 2024
0.4.8 Jun 6, 2024
0.4.4 Mar 30, 2024
0.2.1 Aug 12, 2023

#311 in Rust patterns

Download history 141/week @ 2024-07-29 113/week @ 2024-08-05 108/week @ 2024-08-12 67/week @ 2024-08-19 41/week @ 2024-08-26 143/week @ 2024-09-02 115/week @ 2024-09-09 45/week @ 2024-09-16 58/week @ 2024-09-23 190/week @ 2024-09-30 151/week @ 2024-10-07 151/week @ 2024-10-14 278/week @ 2024-10-21 243/week @ 2024-10-28 159/week @ 2024-11-04 176/week @ 2024-11-11

873 downloads per month

MIT license

63KB
1.5K SLoC

BYONDAPI-rs - Safe rust bindings for BYONDAPI

This crate implements a rusty safe API for using BYONDAPI.

WARNING

This library automatically initializes on the first function call, using OnceCell. This initialization can fail in one circumstance: where the symbols needed by the BYONDAPI are not found in the current executable.

The only sane way to handle this is to panic, which will inevitably unwind across the FFI barrier, which is undefined behavior.

There's two ways to fix this and I've chosen the second:

  1. Make the library API substantially worse by forcing every function to take an argument to a library struct.
  2. Wait for bindgen to stabilize the C-unwind abi

Testing

In order to successfully run cargo test, you must have the following files from the most recent BYOND version in your library search path. For Windows, I recommend copying

For Windows, I recommend copying the following files to the crate root, crates/byondapi-rs/:

  • byond/bin/byondcore.dll
  • byond/bin/byondext.dll
  • byond/bin/byondwin.dll

For Linux, ensure these are in your LD_LIBRARY_PATH:

  • byond/bin/libbyond.so
  • byond/bin/libext.so

Failure to do this will result in an error when trying to run tests.

Dependencies

~0.3–7MB
~53K SLoC