#byond #macro #dm #tg

byond_fn

A utility macro for generating FFI functions for BYOND

5 releases (breaking)

0.5.1 May 14, 2023
0.4.0 May 13, 2023
0.3.0 May 13, 2023
0.2.0 May 12, 2023
0.1.0 May 12, 2023

#149 in FFI

MPL-2.0 license

22KB
380 lines

byond_fn

A macro crate for defining functions callable from BYOND easily and ergonomically

Usage

Basic usage is as simple as:

use byond_fn::byond_fn;

#[byond_fn]
pub fn add(arg1: u8, arg2: u8) -> u8 {
    arg1 + arg2
}

This will generate a extern "C" function called add that can be called from BYOND:

call_ext("example_name.dll", "add")("2", "2") // returns 4

Optional Parameters

If a parameter is an Option, it will be optional to call from BYOND.

All optional parameters must be at the end of the parameter list.


lib.rs:

A macro crate for defining functions callable from BYOND easily and ergonomically

Usage

Basic usage is as simple as:

use byond_fn::byond_fn;

#[byond_fn]
pub fn add(arg1: u8, arg2: u8) -> u8 {
    arg1 + arg2
}

This will generate a extern "C" function called add that can be called from BYOND:

call_ext("example_name.dll", "add")("2", "2") // returns 4

Optional Parameters

If a parameter is an Option, it will be optional to call from BYOND.

All optional parameters must be at the end of the parameter list.

Dependencies

~0.4–1MB
~22K SLoC