[Pas2js] Variable in .LPR: How to make global through entire application?

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Nov 8 13:21:19 CET 2018


On Thu, 8 Nov 2018 06:07:32 -0600 (CST)
warleyalex via Pas2js <pas2js at lists.freepascal.org> wrote:

> I want to declare a variable in the .LPR file so that it can be used
> by all the units in the project.

That's not how Pascal works.

 
> If I declare a variable in the .LPR file , it's scope doesn't seem to
> extend to any of the .pas files comprising the project. I don't want
> to have to put this global vairable in the main form and have every
> single .pas file in the project have to use the main .pas file.   

Why not create a shared unit, where to put all "globals"?
The lpr can initialize the variable of the shared unit.

Mattias


More information about the Pas2js mailing list