Common Variables Between Programs

Please use this Board for QBasic related requests ( file research, programming, etc.)

Moderators:Administrator, Global Moderator

Post Reply
Mike Green9
Newbie
Posts:2
Joined:Mon Feb 28, 2022 10:03 pm
Common Variables Between Programs

Post by Mike Green9 » Mon Feb 28, 2022 10:11 pm

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....

Peter Swinkels
Newbie
Posts:8
Joined:Fri Sep 17, 2021 12:08 pm

Re: Common Variables Between Programs

Post by Peter Swinkels » Tue Mar 08, 2022 8:13 pm

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.
 

Mike Green9
Newbie
Posts:2
Joined:Mon Feb 28, 2022 10:03 pm

Re: Common Variables Between Programs

Post by Mike Green9 » Tue Mar 08, 2022 11:02 pm

Thank You.
M....

Peter Swinkels
Newbie
Posts:8
Joined:Fri Sep 17, 2021 12:08 pm

Re: Common Variables Between Programs

Post by Peter Swinkels » Wed Mar 09, 2022 7:18 pm

You're welcome!

Post Reply