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

Andrew Pennebaker andrew.pennebaker at gmail.com
Fri Oct 14 19:58:44 CEST 2011


Thanks, the conditional execution code helps a lot. Does $IFDEF look for an
environment or Makefile variable?

Cheers,

Andrew Pennebaker
www.yellosoft.us

On Fri, Oct 14, 2011 at 1:06 AM, Søren Ager <soren at agerklanen.dk> wrote:

> 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 at lists.freepascal.**org<fpc-pascal at lists.freepascal.org>
> http://lists.freepascal.org/**mailman/listinfo/fpc-pascal<http://lists.freepascal.org/mailman/listinfo/fpc-pascal>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20111014/830161ee/attachment.html>


More information about the fpc-pascal mailing list