Page 1 of 1

Common Variables Between Programs

Posted: Mon Feb 28, 2022 10:11 pm
by Mike Green9
Hi. (Running under ubuntu 20.04)
I'm trying to chain variables between 2 programs in quickbasic:

Program1:

Code: Select all

' Prog1
COMMON SHARED YY$
YY$ = "Hello20"
LINE INPUT ; "Hit cr "; M$
CHAIN "Prog2"
Program 2:

Code: Select all

' Prog2
COMMON YY$
PRINT "Prog2 Year: ", YY$
LINE INPUT ; "cr", M$
STOP
If I run Prog1.bas and it chains to Prog2.bas, It works i.e Prog2 sees the value of YY$.

If I compile both programs, and execute Prog1, Prog2 NEVER sees the variable in YY$ - it's a null.

Can Anyone Help?
Thanks,
M....

Re: Common Variables Between Programs

Posted: Tue Mar 08, 2022 8:13 pm
by Peter Swinkels
I tried this once and had the same issue. I found this in Quick Basic 4.5's help:

Code: Select all

  Note: To use COMMON with CHAIN when you are compiling outside the
        BASIC environment, you must use the BRUN45.EXE module. This
        module is used when you compile from the command line without
        the /O option or when you use the option from the Make EXE
        dialog box called 'EXE Requiring BRUN45.EXE.
 

Re: Common Variables Between Programs

Posted: Tue Mar 08, 2022 11:02 pm
by Mike Green9
Thank You.
M....

Re: Common Variables Between Programs

Posted: Wed Mar 09, 2022 7:18 pm
by Peter Swinkels
You're welcome!