[−][src]Macro windows_service::define_windows_service
A macro to generate an entry point function (aka "service_main") for Windows service.
The $function_name
function parses service arguments provided by the system
and passes them with a call to $service_main_handler
.
$function_name
- name of the "service_main" callback.
$service_main_handler
- function with a signature fn(Vec<OsString>)
that's called from
generated $function_name
. Accepts parsed service arguments as Vec<OsString>
. Its
responsibility is to create a ServiceControlHandler
, start processing control events and
report the service status to the system.
Example
#[macro_use] extern crate windows_service; use std::ffi::OsString; define_windows_service!(ffi_service_main, my_service_main); fn my_service_main(arguments: Vec<OsString>) { // Service entry point }