How to fix a stack problem

Skip to first unread message

Bob H

Jul 8, 2019, 3:09:39 AM7/8/19
to multisoft FlagShip
I am having a stack problem.

This is the runtime error I
get before the program aborts.
   *** Memory Error: Contents/Boundary Overwritten
   *** Program Call Stack: MyProgram/11<-MYMAIN/24

Using Flagship 7.124 Pro
Windows 10 x64, 32gb memory, ssd

I have compiled the program both ways:
   FlagShip -io=t -exp MYMAIN.prg /
   FlagShip -exp -io=t MYMAIN.prg

But this did not correct the problem.

This is my Fs7config file:

# FSconfig FS7 for MS-Windows and BCC32
# -------------------------------------
# Release $Date: 2012/09/03 14:55:57 $
# Note: if FSDIR: is empty, the $(FSDIR) macro is replaced by the
# FlagShip compiler with <FlagShip_dir>, e.g. by C:\Program Files\FlagShip7.
# $(WINSYS) is replaced by WINSYS_G or WINSYS_ATB according to -io= switch.
# MACRO1...MACRO9 can be used for any user replacements, where MACRO1 is
# pre-defined for include's and switches of C compiler, and MACRO9 for your
# own objects and libraries to be linked with. The FS2LIB macro is reserved.
# Read further details about this file in "fsman" section FSC.1.4.2 and the
# BCC32 documentation for compiler/linker switches

# FSDIR    :D:\Program Files\FlagShip
FSPATH     :
# FSOPTIONS  :-I$(FSDIR)\include -nI=$(FSDIR)\include\std.fh -DFS_BCC32 -DFS_WIN32 -DFlagShip5  -DFlagShip6 -DFlagShip7
FSOPTIONS  :-I$(FSDIR)\include -DFS_BCC32 -DFS_WIN32 -DFlagShip5 -DFlagShip6 -DFlagShip7 
# CCPATH   :D:\PROGRA~1\Borland\Bcc55\bin
CCNAME     :bcc32.exe -q -DFlagShip -DFlagShip5 -DFlagShip6 -DFlagShip7 -pc -p- -w-8004 -w-8008 -w-8019 -w-8045 -w-8057 -w-8060 -w-8064 -w-8065 -w-8066 -w-8071 -w-8080 -w-8079
CCDEBUG    :-lv -v
WINSYS_G   :-laa
FSLIB      :FlagShip7124.lib
FS2LIB     :
LIBDIR     :-LC:\PROGRA~2\FLAGSH~1\BCC55\lib -LC:\PROGRA~2\FLAGSH~1\BCC55\lib\psdk
# LIBDIR   :-LC:\PROGRA~1\Borland\Bcc55\lib -LC:\PROGRA~1\Borland\Bcc55\lib\psdk
MACRO1     :-I"C:\PROGRA~2\FLAGSH~1\BCC55\Include"
# MACRO1   :-IC:\PROGRA~1\Borland\Bcc55\include
MACRO2     :
MACRO3     : 
MACRO4     : 
MACRO5     :kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
MACRO6     :
MACRO7     :
MACRO8     :
## MACRO9 may contain user libraries e.g. -L:D:\my\ownfil~1\libs myownlib.lib otherlib.lib
MACRO9     :

## 1. force static linking via -stat compiler switch
## -----------------------
POSTSTATIC :-lH:4000000 -lHc:2000000 -lS:4000000 -lSc:2000000 -L$(FSDIR) -L$(FSDIR)\lib $(MACRO9) $(FS2LIB) $(WINSYS) $(FSDIR)\lib\$(FSLIB) $(MACRO5)

## 2. force dynamic linking via -dyn compiler switch
## ------------------------
# not available yet, using static
POSTDYNAMIC :-lH:4000000 -lHc:2000000 -lS:4000000 -lSc:2000000 -L$(FSDIR) -L$(FSDIR)\lib $(MACRO9) $(FS2LIB) $(WINSYS) $(FSDIR)\lib\$(FSLIB) $(MACRO5)

## 3. default (here static, with stack size of 4mb)
## ----------
POSTOPTIONS :-lH:4000000 -lHc:2000000 -lS:4000000 -lSc:2000000 -L$(FSDIR) -L$(FSDIR)\lib $(LIBDIR) $(MACRO9) $(FS2LIB) $(WINSYS) $(FSDIR)\lib\$(FSLIB) $(MACRO5)


Per the manual, I should be able to change the
Fs7config file from -f4000000 to -f16000000 but
I don't see this switch listed above.  Is there
a misprint or is there something I should be adding
to this file?

So my question is how to increase stack
size without changing my programs?

Thanks in advance for any assistance.


Jul 8, 2019, 3:31:25 AM7/8/19
to multisoft FlagShip
To increase stack (and heap) size in BCC based application, change linker options in the section "## 3. default" of
your Fs7config file to read e.g.:

 POSTOPTIONS :-lH:8000000 -lHc:4000000 -lS:8000000 -lSc:4000000 ....

 /H:xxxx    Specifies application heap reserve size
 /Hc:xxxx  Specifies application heap commit size
 /S:xxxx    Specifies application stack reserve size
 /Sc:xxxx  Specifies application stack commit size

and test correct setting with FlagShip's -v switch.

Reply all
Reply to author
0 new messages