Skip to content

Commit 97186f7

Browse files
committed
Define the application entry function here.
This definition is used by the OS and the SDK.
1 parent da034fb commit 97186f7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/lib.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,19 @@ pub struct Api {
154154
pub free: extern "C" fn(ptr: *mut core::ffi::c_void, size: usize, alignment: usize),
155155
}
156156

157+
/// The type of the entry function for an application
158+
///
159+
/// * `api` is a pointer to the [`Api`] callback table
160+
/// * `argc` is the number of arguments passed. If this is non-zero, then `argv`
161+
/// must be non-null.
162+
/// * `argv` is a pointer to the start of an array of arguments to the program.
163+
/// Every item in that array is a [`FfiString`]. There are `argc` items in the
164+
/// array.
165+
///
166+
/// The function should return `0` on success, or anything else to indicate an
167+
/// error.
168+
pub type AppStartFn = extern "C" fn(api: *const Api, argc: usize, argv: *const FfiString) -> i32;
169+
157170
/// Describes how something has failed
158171
#[repr(C)]
159172
#[derive(Debug, Copy, Clone, PartialEq, Eq)]

0 commit comments

Comments
 (0)