I have a PB/DOS 3.5 program that runs fine if the main file is compiled with PBC.EXE, and returns a runtime error 9 at 6969 (which seems me not due) if the main file is compiled within PB.EXE (and executed outside the IDE).
Trying to isolate a piece of code to post, the problem goes away. So unfortunately i can' t post a compilable example.
I attach some piece of code just in case to give an idea, however it' s just a general question: is there actually any known reasons for a difference between compiling with PBC and PB, even if restricted to errors detection.
Thanks.
-------- Details ---------
The input data, the PC and OS (W95 4.00.950B) are the same.
The program has several PBUs and $INCLUDE.
The problem started when i added this FUNCTION to a unit.
DECLARE FUNCTION FUNBaseDec(BYVAL Prezzo AS DOUBLE) AS DOUBLE
' ======>
FUNCTION FUNBaseDec(BYVAL Prezzo AS DOUBLE) AS DOUBLE
DIM Decimali AS LOCAL DOUBLE, N AS LOCAL INTEGER
IF BaseDecPrezziVideoBD_g > 0 THEN
N = 100 ' : 2 decimali.
IF BaseDecPrezziVideoBD_g < N THEN
' : La base (es. 32 per il Bond) è coerente con il num. di cifre dec.
' autorizzate.
' ------> Estrae 2 (se N = 100) cifre decimali.
Decimali = INT(Prezzo * N) / N ' : XXXXX.xx
Decimali = Decimali - INT(Decimali)' : 0.xx
Decimali = Decimali * N ' : xx
' <------
' ------> Trasforma i decimali da 100esimi a BaseDecPrezziVideoBD_g-esimi.
Decimali = Decimali * (BaseDecPrezziVideoBD_g / N) ' : xx
' <------
FUNBaseDec = INT(Prezzo) + Decimali / N ' : XXXXX.xx
ELSE
PRINT: PRINT "!!!!! ERRORE 882 ! FUNBaseDec: BaseDecPrezziVideoBD_g="; BaseDecPrezziVideoBD_g; "N="; N; " -- COMUNICARLO !!"
BEEP: BEEP: BEEP
END
END IF
ELSE
FUNBaseDec = Prezzo
END IF
END FUNCTION
' <======
If i REM all these statements, recompile all the units with PBC and the main module with PB, the error doesn' t occurr. If i unREM these statements and recompile all the same way, the error occurrs.
So, with PB the error occurrs only if these statements are active, and with PBC the error never occurrs, not even with these lines active.
However the runtime error 9 doesn' t occurr in this function, but on the line
IntestCMX_s$(1, 7) = zTAB$+"TSU"
Looking at the code, this statement is near to the top of main module and should only be executed once, at program startup, much before the moment the runtime error occurrs.
I think this array doesn' t matter, anyway it' s previously declared with
DIM DYNAMIC FmtCMX_s(1 TO 2, 1 TO 7) AS STRING, IntestCMX_s(1 TO 2, 1 TO 7) AS STRING
PUBLIC FmtCMX_s$(MIN, 2), IntestCMX_s$(MIN, 2)
PBC.EXE and PB.EXE are 18 Dec 97 3.50.
Each unit and the main module have these lines.
-----------
$DIM ALL
$DYNAMIC
$CPU 80386
$ERROR ALL ON
$FLOAT NPX
$OPTIMIZE SPEED
$OPTION CNTLBREAK OFF
$OPTION GOSUB OFF
$STACK 8192
$LIB IPRINT ON
$LIB COM OFF
DEFINT A-Z: OPTION BASE 1
-----------
PBC is run with the options /OP /OU.
The compilation options of the IDE are:
=================¦ Compiler
----------------------------------
Code generation 8086/8088
Floating point Emulation
Variable declarations None
Optimize Faster
Gosub preserve if error Off
Map file generation Off
Pathnames in unit debug On
Unit: full debug info On
Attach PBD debug info Off
Error tests
+--------------------+------------
¦ Stack test Off ¦
¦ Bounds test Off ¦
¦ Overflow test Off ¦
¦ Numeric test Off ¦
==¦ Linker ¦
--------------------------
Serial communications On
Printer On
Control-Break (EXE) On
Full float emulation Off
Interpreted print Off
Graphics On
Video cards
+----------+--------------
¦ CGA On ¦
¦ EGA On ¦
¦ VGA On ¦
Trying to isolate a piece of code to post, the problem goes away. So unfortunately i can' t post a compilable example.
I attach some piece of code just in case to give an idea, however it' s just a general question: is there actually any known reasons for a difference between compiling with PBC and PB, even if restricted to errors detection.
Thanks.
-------- Details ---------
The input data, the PC and OS (W95 4.00.950B) are the same.
The program has several PBUs and $INCLUDE.
The problem started when i added this FUNCTION to a unit.
DECLARE FUNCTION FUNBaseDec(BYVAL Prezzo AS DOUBLE) AS DOUBLE
' ======>
FUNCTION FUNBaseDec(BYVAL Prezzo AS DOUBLE) AS DOUBLE
DIM Decimali AS LOCAL DOUBLE, N AS LOCAL INTEGER
IF BaseDecPrezziVideoBD_g > 0 THEN
N = 100 ' : 2 decimali.
IF BaseDecPrezziVideoBD_g < N THEN
' : La base (es. 32 per il Bond) è coerente con il num. di cifre dec.
' autorizzate.
' ------> Estrae 2 (se N = 100) cifre decimali.
Decimali = INT(Prezzo * N) / N ' : XXXXX.xx
Decimali = Decimali - INT(Decimali)' : 0.xx
Decimali = Decimali * N ' : xx
' <------
' ------> Trasforma i decimali da 100esimi a BaseDecPrezziVideoBD_g-esimi.
Decimali = Decimali * (BaseDecPrezziVideoBD_g / N) ' : xx
' <------
FUNBaseDec = INT(Prezzo) + Decimali / N ' : XXXXX.xx
ELSE
PRINT: PRINT "!!!!! ERRORE 882 ! FUNBaseDec: BaseDecPrezziVideoBD_g="; BaseDecPrezziVideoBD_g; "N="; N; " -- COMUNICARLO !!"
BEEP: BEEP: BEEP
END
END IF
ELSE
FUNBaseDec = Prezzo
END IF
END FUNCTION
' <======
If i REM all these statements, recompile all the units with PBC and the main module with PB, the error doesn' t occurr. If i unREM these statements and recompile all the same way, the error occurrs.
So, with PB the error occurrs only if these statements are active, and with PBC the error never occurrs, not even with these lines active.
However the runtime error 9 doesn' t occurr in this function, but on the line
IntestCMX_s$(1, 7) = zTAB$+"TSU"
Looking at the code, this statement is near to the top of main module and should only be executed once, at program startup, much before the moment the runtime error occurrs.
I think this array doesn' t matter, anyway it' s previously declared with
DIM DYNAMIC FmtCMX_s(1 TO 2, 1 TO 7) AS STRING, IntestCMX_s(1 TO 2, 1 TO 7) AS STRING
PUBLIC FmtCMX_s$(MIN, 2), IntestCMX_s$(MIN, 2)
PBC.EXE and PB.EXE are 18 Dec 97 3.50.
Each unit and the main module have these lines.
-----------
$DIM ALL
$DYNAMIC
$CPU 80386
$ERROR ALL ON
$FLOAT NPX
$OPTIMIZE SPEED
$OPTION CNTLBREAK OFF
$OPTION GOSUB OFF
$STACK 8192
$LIB IPRINT ON
$LIB COM OFF
DEFINT A-Z: OPTION BASE 1
-----------
PBC is run with the options /OP /OU.
The compilation options of the IDE are:
=================¦ Compiler
----------------------------------
Code generation 8086/8088
Floating point Emulation
Variable declarations None
Optimize Faster
Gosub preserve if error Off
Map file generation Off
Pathnames in unit debug On
Unit: full debug info On
Attach PBD debug info Off
Error tests
+--------------------+------------
¦ Stack test Off ¦
¦ Bounds test Off ¦
¦ Overflow test Off ¦
¦ Numeric test Off ¦
==¦ Linker ¦
--------------------------
Serial communications On
Printer On
Control-Break (EXE) On
Full float emulation Off
Interpreted print Off
Graphics On
Video cards
+----------+--------------
¦ CGA On ¦
¦ EGA On ¦
¦ VGA On ¦
Comment