Start from a main routine

From Rosetta Code
Revision as of 07:39, 12 July 2011 by rosettacode>Markhobley (initial draft)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Start from a main routine is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

Some languages (like gambas and visual basic) support two startup modes. Applications written on these platforms start with an open window that waits for events, and it is necessary to do some jiggerypokery to cause a main procedure to run instead.

The task is to demonstrate the steps involved in causing the application to run a main procedure, rather than an event driven window at startup.

Gambas

In [gambas], to make an application startup from a main routine:

  • Create a new module called MMain
  • In the MMain module, create a public sub called Main as follows:

<lang gambas>PUBLIC SUB Main()

  ' This is the start of the program
END</lang>
  • Right click the MMain module, then select Startup class from the context menu