2018-11-13 18:17:32 -08:00
|
|
|
use account::KeyedAccount;
|
|
|
|
|
|
|
|
// All native programs export a symbol named process()
|
|
|
|
pub const ENTRYPOINT: &str = "process";
|
|
|
|
|
|
|
|
// Native program ENTRYPOINT prototype
|
|
|
|
pub type Entrypoint =
|
2018-11-13 18:18:40 -08:00
|
|
|
unsafe extern "C" fn(keyed_accounts: &mut [KeyedAccount], data: &[u8], tick_height: u64)
|
|
|
|
-> bool;
|
2018-11-13 18:38:51 -08:00
|
|
|
|
|
|
|
// Convenience macro to define the native program entrypoint. Supply a fn to this macro that
|
|
|
|
// conforms to the `Entrypoint` type signature.
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! solana_entrypoint(
|
|
|
|
($entrypoint:ident) => (
|
|
|
|
#[no_mangle]
|
2018-11-13 18:18:40 -08:00
|
|
|
pub extern "C" fn process(keyed_accounts: &mut [KeyedAccount], data: &[u8], tick_height: u64) -> bool {
|
|
|
|
return $entrypoint(keyed_accounts, data, tick_height);
|
2018-11-13 18:38:51 -08:00
|
|
|
}
|
|
|
|
)
|
|
|
|
);
|