Runtime error when running compiled program only 
Author Message
 Runtime error when running compiled program only

Hi group,
        I searched for old posts at deja.com about this, thinking it might
be a fairly frequently asked question; but I found nothing.  So my
apologies if it is indeed a FAQ!
        I have a program that runs perfectly from the Turbo Pascal 4.0 IDE
(i.e., when I compile it to memory and run).  But when I try to run the
compiled program from disk (either in MS-DOS mode, or in a DOS window), it
crashes due to runtime error 205 (a floating point error).  It would be
most convenient if I could run the program from a DOS window, so I would
be grateful if someone out there can suggest a solution.

Thanks,
Bruce
--
Bruce Weaver

http://www.*-*-*.com/



Wed, 18 Jun 1902 08:00:00 GMT  
 Runtime error when running compiled program only


Quote:
>Hi group,
>    I searched for old posts at deja.com about this, thinking it might
>be a fairly frequently asked question; but I found nothing.  So my
>apologies if it is indeed a FAQ!
>    I have a program that runs perfectly from the Turbo Pascal 4.0 IDE
>(i.e., when I compile it to memory and run).  But when I try to run the
>compiled program from disk (either in MS-DOS mode, or in a DOS window), it
>crashes due to runtime error 205 (a floating point error).  It would be
>most convenient if I could run the program from a DOS window, so I would
>be grateful if someone out there can suggest a solution.

The program has a bug. You need to fix it.

Osmo



Wed, 18 Jun 1902 08:00:00 GMT  
 Runtime error when running compiled program only

Quote:



---------------------- >8 -----------------------

Quote:
> > I have a program that runs perfectly from the Turbo Pascal 4.0 IDE
> >(i.e., when I compile it to memory and run).  But when I try to run the
> >compiled program from disk (either in MS-DOS mode, or in a DOS window), it
> >crashes due to runtime error 205 (a floating point error).  It would be
> >most convenient if I could run the program from a DOS window, so I would
> >be grateful if someone out there can suggest a solution.

> >Thanks,
> >Bruce

> Bruce,

> You might compile your program from the command prompt
> with the Map File option switch:

> TPC MyCode /GD

> This will generate a map file "MyCode.map". If you know the
> segment/offset where the runtime error occurs then you can
> use MyCode.map to find the offending line of code. This
> will allow you to add diagnostic code to find out why your
> floating point numbers overflow. It could be an uninitialised
> variable that <<happens>> to be set to a low value in the IDE
> but goes very large outside the IDE.

> KlausL

Thanks Klaus, I will give that a try.  Your idea about unitialized
variable sounds like good place to start looking.

Cheers,
Bruce



Wed, 18 Jun 1902 08:00:00 GMT  
 Runtime error when running compiled program only


---------------------- >8 -----------------------

Quote:
> >       I have a program that runs perfectly from the Turbo Pascal 4.0 IDE
> >(i.e., when I compile it to memory and run).  But when I try to run the
> >compiled program from disk (either in MS-DOS mode, or in a DOS window), it
> >crashes due to runtime error 205 (a floating point error).  It would be
> >most convenient if I could run the program from a DOS window, so I would
> >be grateful if someone out there can suggest a solution.

> The program has a bug. You need to fix it.

> Osmo

Gee, I never thought of that.  Thanks.


Wed, 18 Jun 1902 08:00:00 GMT  
 Runtime error when running compiled program only

Quote:

>Hi group,
> I searched for old posts at deja.com about this, thinking it might
>be a fairly frequently asked question; but I found nothing.  So my
>apologies if it is indeed a FAQ!
> I have a program that runs perfectly from the Turbo Pascal 4.0 IDE
>(i.e., when I compile it to memory and run).  But when I try to run the
>compiled program from disk (either in MS-DOS mode, or in a DOS window), it
>crashes due to runtime error 205 (a floating point error).  It would be
>most convenient if I could run the program from a DOS window, so I would
>be grateful if someone out there can suggest a solution.

>Thanks,
>Bruce
>--
>Bruce Weaver

>http://www.angelfire.com/wv/bwhomedir/

Bruce,

You might compile your program from the command prompt
with the Map File option switch:

TPC MyCode /GD

This will generate a map file "MyCode.map". If you know the
segment/offset where the runtime error occurs then you can
use MyCode.map to find the offending line of code. This
will allow you to add diagnostic code to find out why your
floating point numbers overflow. It could be an uninitialised
variable that <<happens>> to be set to a low value in the IDE
but goes very large outside the IDE.

KlausL



Wed, 18 Jun 1902 08:00:00 GMT  
 Runtime error when running compiled program only

Quote:

> Hi group,
>         I searched for old posts at deja.com about this, thinking it might
> be a fairly frequently asked question; but I found nothing.  So my
> apologies if it is indeed a FAQ!
>         I have a program that runs perfectly from the Turbo Pascal 4.0 IDE
> (i.e., when I compile it to memory and run).  But when I try to run the
> compiled program from disk (either in MS-DOS mode, or in a DOS window), it
> crashes due to runtime error 205 (a floating point error).  It would be
> most convenient if I could run the program from a DOS window, so I would
> be grateful if someone out there can suggest a solution.

> Thanks,
> Bruce
> --
> Bruce Weaver

> http://www.angelfire.com/wv/bwhomedir/

I have had a similar problem once. If my memory serves me
right, this was due to an uninitialized variable (that gets
somehow initialized or is initialized differently within the
IDE).

Jyrki Lahtonen, Ph.D.
Department of Mathematics,
University of Turku,
FIN-20014 Turku, Finland



Wed, 18 Jun 1902 08:00:00 GMT  
 Runtime error when running compiled program only

Quote:



---------------------- >8 -----------------------

Quote:
> > I have a program that runs perfectly from the Turbo Pascal 4.0 IDE
> >(i.e., when I compile it to memory and run).  But when I try to run the
> >compiled program from disk (either in MS-DOS mode, or in a DOS window), it
> >crashes due to runtime error 205 (a floating point error).  It would be
> >most convenient if I could run the program from a DOS window, so I would
> >be grateful if someone out there can suggest a solution.

---------------------- >8 -----------------------

Quote:

> Bruce,

> You might compile your program from the command prompt
> with the Map File option switch:

> TPC MyCode /GD

> This will generate a map file "MyCode.map". If you know the
> segment/offset where the runtime error occurs then you can
> use MyCode.map to find the offending line of code. This
> will allow you to add diagnostic code to find out why your
> floating point numbers overflow. It could be an uninitialised
> variable that <<happens>> to be set to a low value in the IDE
> but goes very large outside the IDE.

> KlausL

I was going to try what Klaus suggested, but I could not get it to work.
It appears that version 4 does not have quite the same options as later
versions.  Here's the list for version 4:

Turbo Pascal  Version 4.0  Copyright (c) 1987 Borland International
Syntax: TPC [options] filename [options]
/B      Build all units         /$B+    Complete boolean evaluation
/Dxxx   Define conditionals     /$D-    No debug information
/Exxx   Executable directory    /$F+    Force FAR calls
/Fxxx   Find run-time error     /$I-    No I/O checking
/Ixxx   Include directories     /$L-    No link buffer
/M      Make modified units     /$Mxxx  Memory allocation parameters
/Oxxx   Object directories      /$N+    8087 numeric co-processor
/Q      Quiet compile           /$R+    Range checking
/Rxxx   Run in memory           /$S-    No stack checking
/Txxx   Turbo directories       /$T+    Generate TPM file
/Uxxx   Unit directories        /$V-    No var-string checking
/Xxxx   Execute on disk

What I DID discover, however, is that I could enter segment:offsett from
the error message under Compile-->Find Error in the pull-down menu in the
IDE.  This took me to the offending line of code.

Thanks again to all who replied.

Cheers,
Bruce
--
Bruce Weaver

http://www.angelfire.com/wv/bwhomedir/



Wed, 18 Jun 1902 08:00:00 GMT  
 Runtime error when running compiled program only


:       I have a program that runs perfectly from the Turbo Pascal 4.0 IDE
:(i.e., when I compile it to memory and run).  But when I try to run the
:compiled program from disk (either in MS-DOS mode, or in a DOS window), it
:crashes due to runtime error 205 (a floating point error).  It would be
:most convenient if I could run the program from a DOS window, so I would

 165966 Jan 8 2000 ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip
 tsfaqp.zip Common Turbo Pascal Questions and Timo's answers, linked

41. *****
 Q: What is wrong with my program? It hangs without a clear pattern?

 A: With experience one learns that some programming errors are very
elusive. I have many times seen users declaring that they have found
a bug in Turbo Pascal, but in the overwhelming majority of cases it
still is just a programming error, which just is more difficult to
find than the more clear-cut cases. When you have symptoms like your
program crashing from within the IDE, but working seemingly all
right when called as stand-alone, or something equally strange, you
might have one of the following problems.
- A variable or some variables in your code are uninitialized thus
  getting random values, which differ depending on your environment.
- Your indexes are overflowing. Set on the range check {$R+}
  directive for testing.
- An error in the pointer logic.
Normal debugging does not necessarily help in locating these errors
because one is easily led to debugging the wrong parts of one's
program. Especially the latter two reasons can cause errors which
seemingly have nothing to do with the actual cause. This dilemma
results from the fact that indexing and pointer errors can overwrite
parts of memory causing strange quirks in your program. If you have
used indexing with {$R-} or if you use pointer operations, sooner or
later you are bound to have these problems in developing your
applications.
   See Edward Mitchell (1993), Borland Pascal Developer's Guide,
275-288 for common programming errors and especially the information
on memory clobbering, in a useful chapter on debugging Turbo Pascal
programs. You might also take a look at your Turbo Pascal User's
Guide. At least version 7.0 has an instructive general
categorization of errors on pages 76-77.

 A2: Further, insidious problems can occur if you are compiling /
running your program in a Windows dosbox. The worst case, of course
is if your Windows system is somehow damaged, unrelated to your TP
program. One of the nastiest possibilities is e.g. that the Windows
registry is damaged. Then it could be that your last resort is
reinstalling Windows. However, before you consider anything so
drastic, you are bound to notice problems with many other programs
than your TP compiler or TP programs.
--------------------------------------------------------------------

   All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa

Digital photos collection at http://www.uwasa.fi/ktt/lasktoim/photo/



Wed, 18 Jun 1902 08:00:00 GMT  
 Runtime error when running compiled program only



:> The program has a bug. You need to fix it.
:Gee, I never thought of that.  Thanks.

Just a minute, please. In all its briefness, Osmo's point is
essential. For a much more complete, but underneath the same answer,
see my posting from the FAQ on your dilemma.

   All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa

Timo's  procmail tips at  http://www.uwasa.fi/~ts/info/proctips.html



Wed, 18 Jun 1902 08:00:00 GMT  
 Runtime error when running compiled program only

Quote:

>- An error in the pointer logic.

When writing structures using pointers it is good to store some extra
information, like the length of a linked lists. This then can be used to
verify the integrity of the structure. One could even do that routinely
when the program is idle. That way errors are quite easy to find.

Function ListOK(p:pnode;len:longint);
Begin
  while (p<>nil) and (len>0) and not keypressed do begin
    p:=p^.next;
    dec(len);
  End;
  ListOK:=(len=0) and (p=nil) or keypressed;
End;
...

If not ListOK(list.first,list.len) then Runerror(255);
c:=readkey;

Similar thing could also be used with trees, though one needs slightly
more logic to escape the recursion.

Osmo



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. run time error when compiled

2. Reading Compile/run errors from outside TurboPascal

3. Runtime error 200 when running under Windows 95 / Windows NT

4. error msg when compiling program

5. pascal program hangs although no compiling errors

6. Logging Runtime Error Codes and location to file before exitting program

7. Help - Error found when running a program

8. Error running programs within IDE

9. Delphi CGI Problem - CGI Program Only Runs When Delphi Also Runs

10. compile pascal to run on controllers ...ROM'able code

11. compile pascal to run on controllers

12. Info on how to run an executable from a pascal compiled executable

 

 
Powered by phpBB® Forum Software