[fpc-pascal] How do I load external Pascal code?

Søren Ager soren at agerklanen.dk
Fri Oct 14 07:06:02 CEST 2011


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



More information about the fpc-pascal mailing list