9 unstable releases (3 breaking)

0.4.4 Mar 30, 2024
0.4.3 Mar 30, 2024
0.3.1 Dec 14, 2023
0.2.1 Aug 12, 2023
0.1.0 Aug 3, 2023

#364 in Rust patterns

Download history 3/week @ 2024-01-08 7/week @ 2024-01-15 7/week @ 2024-01-22 8/week @ 2024-02-05 12/week @ 2024-02-19 59/week @ 2024-02-26 309/week @ 2024-03-04 72/week @ 2024-03-11 29/week @ 2024-03-18 274/week @ 2024-03-25 158/week @ 2024-04-01 133/week @ 2024-04-08

599 downloads per month

MIT license

61KB
1K 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 lazy_static!. 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.5–9MB
~57K SLoC