QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: MMUELLER57 on July 27, 2017, 05:15:25 am

Title: QB64 CHAIN Command: Will CHAIN 1st.exe to 2nd.exe, but closes 1st.exe.
Post by: MMUELLER57 on July 27, 2017, 05:15:25 am
QB64 V1.1.0.0 does not allow control to go back to 1st.exe, 1st.exe closes as soon as the CHAIN to 2nd.exe is accomplished.

Thought of CHAINing back to 1st.exe from 2nd.exe, as in my example, 1st.exe is a menu system.  The behavior when doing this within COMMON to a application that variables are passed, will probably be problematic.

Any views on when this feature would be in place?  I really do not like using the term "Bug" as this problem/command may actually be performing as defined.  It does not make sense but who am I to judge.

Please let me know your findings.

Thank you
Title: Re: QB64 CHAIN Command: Will CHAIN 1st.exe to 2nd.exe, but closes 1st.exe.
Post by: SMcNeill on July 27, 2017, 08:12:59 am
QB45 used CHAIN as a way to modularize programs and get around memory limits.  QB64 doesn't have those issues as it'll use several GB of memory if necessary, so nobody is doing any real work trying to implement/expand/support the command.  Unless it's completely necessary for your programs, I'd suggest not to bother using it.
Title: Re: QB64 CHAIN Command: Will CHAIN 1st.exe to 2nd.exe, but closes 1st.exe.
Post by: bplus on July 27, 2017, 08:17:04 am
Hi,

Run works in QB64 doesn't it?

Append: I mean if I RUN a command line, I will be returned to calling program when it finishes, right?

Append 2: Oh! I might be thinking of SHELL command. :) (bplus is rusty)
Title: Re: QB64 CHAIN Command: Will CHAIN 1st.exe to 2nd.exe, but closes 1st.exe.
Post by: Petr on July 27, 2017, 01:42:17 pm
If you use SHELL _DONTWAIT "command" then you not waiting for his end, or with SHELL _HIDE - command is unseen.
If you call with CHAIN   .BAS file, QB64 automaticaly create EXE from this, you not need extension to name written, QB64 automaticaly search BAS or EXE. For sharing datas use COMMON SHARED:

First example is named as a.bas

Code: QB64: [Select]
  1. PRINT "First EXE (a.exe) is runnig. VALUE setting to 1000"
  2.  
  3. VALUE = 1000
  4.  
  5. CHAIN "b"
  6.  

second code is named as B.bas

Code: QB64: [Select]
  1. PRINT "Second EXE (b.exe) is runnig. VALUE is"; VALUE
  2.  
  3. CHAIN "a"
  4.  

this two programs cycling. For end click to X in right upper corner when B is runned.
Title: Re: QB64 CHAIN Command: Will CHAIN 1st.exe to 2nd.exe, but closes 1st.exe.
Post by: bplus on July 27, 2017, 02:04:22 pm
Options!

Thanks Petr
Title: Re: QB64 CHAIN Command: Will CHAIN 1st.exe to 2nd.exe, but closes 1st.exe.
Post by: FellippeHeitor on July 27, 2017, 02:21:32 pm
The whole idea of CHAIN back in DOS days was to switch between to executables seamlessly, hence the termination of the first .EXE so that the user will continue with only one program in memory.

Keep in mind that QB64 does all it can to emulate the original functionality of CHAIN (including the hack of transfering variables through a disk file, since memory isn't shared) so that older programs can be run as they used to originally without much trouble. However, there aren't module size limitations in Qb64 and if you're writing a new project, you should be able to have all the code in a single module, elliminating the need for CHAIN altogether.

If you feel you should break a bigger project into smaller parts, consider making $INCLUDE files, that are more manageable, but will generate a single EXE in the end.