[Overview][Resource strings][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'daemonapp' (#fcl)

# TDaemonController.Main

Daemon main entry point

## Declaration

Source position: daemonapp.pp line 129

`public procedure TDaemonController.Main(`
`Argc: DWord;`
`Args: PPChar`
`); virtual;`

## Arguments

`Argc` |  | Command-line arguments passed by the OS. The first is normally the service name
`Args` |  | Arguments for the service.

## Description

Main is the service's main entry point, called when the system wants to start the service. The global application will call this function whenever required, with the appropriate arguments.

The standard implementation starts the daemon thread, and waits for it to stop. All other daemon action - such as responding to control code events - is handled by the thread.

## Errors

If the daemon thread cannot be created, an exception is raised.

## See also

TDaemonThread |  | Thread to run daemons in

The latest version of this document can be found at lazarus-ccr.sourceforge.net .