On 2011-10-14 05:17, Andrew Pennebaker wrote:

In some languages, especially scripting languages,

Pascal is not a scripted language so it is not really something you want (or should imo) to do in Pascal

Let's say I want to write a dual-purpose Fibonacci program, fib.p. It
should:

Then you should create 2 .p files 1 for the unit and 1 for the exe (that uses the unit)


If you really want to do it you will have to do it with ifdef's:

{$IFDEF exe}
program ScriptedMain;
{$ELSE}
unit ScriptedMain;
{$ENDIF}

and do that with everything that is different between exe and unit - not an elegant solution but it should work.


--

Hilsen
  Søren
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to