You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently attempting to call the controllers functions as seen here in order to get a list of connected controllers on mac. I'm attempting to achieve this with the following code:
use objc::{class, msg_send, sel, sel_impl};use objc::runtime::{BOOL,Object};fnmain(){unsafe{let class = class!(GCController);let selector = sel!(controllers);let obj:*mutObject = msg_send![class, new];let _:*mutObject = msg_send![class, selector];// Even void methods must have their return type annotatedlet _:() = msg_send![obj, release];}}
However, it fails as follows:
thread 'main' panicked at 'Class with name GCController could not be found', src/main.rs:6:21
stack backtrace:0: rust_begin_unwind
at /rustc/2f3ddd9f594adf9773547aa7cedb43c4ac8ffd2f/library/std/src/panicking.rs:584:51:core::panicking::panic_fmt
at /rustc/2f3ddd9f594adf9773547aa7cedb43c4ac8ffd2f/library/core/src/panicking.rs:142:142:objc_test::main
at ./src/main.rs:6:213:core::ops::function::FnOnce::call_once
at /rustc/2f3ddd9f594adf9773547aa7cedb43c4ac8ffd2f/library/core/src/ops/function.rs:248:5
note:Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
How do I link against the Controllers framework to get this to work? Also, any advice for calling functions would be incredibly appreciated.
The text was updated successfully, but these errors were encountered:
Note that it doesn't matter what's inside the extern block.
any advice for calling functions would be incredibly appreciated.
In my fork I've documented the msg_send! macro a bit more, especially with regards to safety requirements, that might help you a bit of the way there. Also beware that you need to follow Cocoa's memory management rules when working with objects.
I'm currently attempting to call the controllers functions as seen here in order to get a list of connected controllers on mac. I'm attempting to achieve this with the following code:
However, it fails as follows:
How do I link against the Controllers framework to get this to work? Also, any advice for calling functions would be incredibly appreciated.
The text was updated successfully, but these errors were encountered: