diff options
Diffstat (limited to 'rust/src/symbol.rs')
| -rw-r--r-- | rust/src/symbol.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/rust/src/symbol.rs b/rust/src/symbol.rs index 22c2b051..59080814 100644 --- a/rust/src/symbol.rs +++ b/rust/src/symbol.rs @@ -166,7 +166,7 @@ impl<S: BnStrCompatible> SymbolBuilder<S> { self.ordinal, ); - Ref::new(Symbol::from_raw(res)) + Symbol::ref_from_raw(res) } } } @@ -177,6 +177,10 @@ pub struct Symbol { } impl Symbol { + pub(crate) unsafe fn ref_from_raw(raw: *mut BNSymbol) -> Ref<Self> { + Ref::new(Self { handle: raw }) + } + pub(crate) unsafe fn from_raw(raw: *mut BNSymbol) -> Self { Self { handle: raw } } @@ -226,6 +230,11 @@ impl Symbol { pub fn auto_defined(&self) -> bool { unsafe { BNIsSymbolAutoDefined(self.handle) } } + + /// Wether this symbol has external linkage + pub fn external(&self) -> bool { + self.binding() == Binding::Weak || self.binding() == Binding::Global + } } unsafe impl Send for Symbol {} |
