-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Static member functions #1419
Comments
What is the current workaround for this currently? // Inside namespace named "Monero"
struct WalletManagerFactory
{
// logging levels for underlying library
enum LogLevel {
LogLevel_Silent = -1,
LogLevel_0 = 0,
LogLevel_1 = 1,
LogLevel_2 = 2,
LogLevel_3 = 3,
LogLevel_4 = 4,
LogLevel_Min = LogLevel_Silent,
LogLevel_Max = LogLevel_4
};
static WalletManager * getWalletManager();
static void setLogLevel(int level);
static void setLogCategories(const std::string &categories);
}; I want to call #[cxx::bridge(namespace = "Monero")]
pub mod ffi {
unsafe extern "C++" {
include!("monero-wrapper/monero/src/wallet/api/wallet2_api.h");
type WalletManager;
type WalletManagerFactory;
#[namespace = "Monero::WalletManagerFactory"]
fn getWalletManager() -> *mut WalletManager;
}
} |
Workaround is here: #464. Basically, create a freestanding function that acts as a shim. |
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
is there a way to declare a c++ opaque type with a static member? then have it translate to an associated function on the rust side? perhaps something like
with the c++ like
The text was updated successfully, but these errors were encountered: