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
This should be trivial to do (once libtheseus is sorted out).
We can define a function in std::sys::theseus as follows:
pubunsafefn__theseus_start(args:Vec<String>) -> isize{let argc = args.len();let argv = args.as_ptr();extern"C"{// This function is exported by Rust (and all other language) binaries.fnmain(argc:isize,argv:*const*constc_char) -> i32;}// Do initialisation.let result = unsafe{main(argc assize, argv)};// Do cleanup.
result asisize}
* This code is untested.
To run a crate we would then run __theseus_start similar to how we currently run main functions exported by applications. The process of finding the section and transmuting it to a function pointer would remain the same.
I believe std::sys::theseus::init is called by the main function exported by binaries. E.g. Hermit's runtime_entry function doesn't initialise the network because it's done in init, which will be called by main.
The text was updated successfully, but these errors were encountered:
This should be trivial to do (once
libtheseus
is sorted out).We can define a function in
std::sys::theseus
as follows:* This code is untested.
To run a crate we would then run
__theseus_start
similar to how we currently runmain
functions exported by applications. The process of finding the section and transmuting it to a function pointer would remain the same.Hermit does a slightly similar thing.
I believe
std::sys::theseus::init
is called by themain
function exported by binaries. E.g. Hermit'sruntime_entry
function doesn't initialise the network because it's done ininit
, which will be called bymain
.The text was updated successfully, but these errors were encountered: