Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

QB45: Correct Method of CHAINING @ Compile 2

Status
Not open for further replies.

bryandj23

IS-IT--Management
Aug 18, 2003
105
0
0
US
Hi All. Thanks in advance for looking at this thread.

Have a program (BBS Door Game, actually) that CHAINS off to another .BAS file if a certain condition is met (if the program is run on the first of the month). This was required due to memory limitations on BC.EXE at compile time. The second BAS file is contained within the main BAS file as a MODULE (Load File... in the IDE).

Within the IDE, this method works:

IF firstofmonth, then CHAIN "MAINT.BAS"

Maint.BAS runs through some stuff, then contains:

RUN MC.EXE at the end to re-start the original EXE.

This works in the IDE without issue or error.

Upon compile time, BC compiles both, and LINK joins the two sources as a single EXE. Exactly what I'm looking for.

At runtime of the compiled program, a 'file not found' error is produced. I've recompiled with logging, and verified it's my chain command that is failing. Makes sense.

I found some posts that suggested removing the .BAS from the CHAIN command, gave that a whirl. Same. Tried with .EXE in the extension. Same. I don't believe I can CALL my module; I can only CALL SUB or CALL FUNCTION.

Looking at some other program's source code, I see where each individual file contained is different parts of the program; Main module in one .BAS file, SUBS in another .BAS file, Functions in another .BAS file. Then they get compiled together at compile time. Perhaps I'm just going about my CHAINing theory all wrong.

Any tips or ideas?

Thanks very much!
Bryan
 
Posting this here in case I need to find it 25 years from now...

"Module" (Load File) acts as an extension to your main module for compilation purposes. So, it's just a tack-on to what you've already defined. For me, instead of CHAINing the Module, the Module contains only a SUB which contains the code of the original CHAINed program. The SUB is then CALLed from the main module, as if it were part of the main module already, but is compiled separately and then linked when creating the EXE.

Now I just need to update my code in the {MODULE:SUB} to utilize functions of the main module.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top