Author Topic: QB64 CHAIN Command: Will CHAIN 1st.exe to 2nd.exe, but closes 1st.exe.  (Read 7609 times)

0 Members and 1 Guest are viewing this topic.

Offline MMUELLER57

  • Newbie
  • Posts: 1
    • View Profile
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

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
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.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
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)
« Last Edit: July 27, 2017, 08:46:12 am by bplus »

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
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.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Options!

Thanks Petr

FellippeHeitor

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