Function rusty_xinput::dynamic_load_xinput
source · pub fn dynamic_load_xinput() -> Result<(), XInputLoadingFailure>
Expand description
Attempts to dynamically load an XInput DLL and get the function pointers.
This operation is thread-safe and can be performed at any time. If xinput
hasn’t been loaded yet, or if there was a failed load attempt, then
xinput_get_state
and xinput_set_state
will safety return an Err
value
to that effect.
There’s no way provided to unload XInput once it’s been loaded, because that makes the normal operation a little faster. Why would you want to unload it anyway? Don’t be silly.
Failure
This can fail in a few ways, as explained in the XInputLoadingFailure
type. The most likely failure case is that the user’s system won’t have the
required DLL, in which case you should probably allow them to play with just
a keyboard/mouse instead.
Current DLL Names
Currently the following DLL names are searched for in this order:
xinput9_1_0.dll
xinput1_4.dll
xinput1_3.dll
xinput1_2.dll
xinput1_1.dll