[comp.lang.c] QC problems

richw@rosevax.Rosemount.COM (Rich Wagenknecht) (01/05/88)

  I've found what appears to be a very strange problem with MS QC 1.0.
I've developed some windowing software which makes extensive use of
far character arrays and the movedate function. I originally developed
the software under QC 1.0 using the in memory compilation option. The
software worked well and I was ready to compile to an executable file.
I compiled using the executable option and again all went well (ie no
compiler warnings or sneezes). When I ran the executable my machine
went completely wild and locked up. Hmm. I've now spent several days
tracing over my source code looking for wild pointers etc. Nothing.
The software runs perfectly under QC with in memory compilation but will
not run when compiled to an executable using QC or MSC 5.0. Now, it
could very well be that my code is at fault. However, QC 1.0 is useless
to me because it does run my software in memory without any problems!
Notice that I have not said that MS is at fault. I just can't understand
how my software could run under QC but not as a stand alone executable.
Has anyone else experienced anything similar?

Rich W

kwok@iris.ucdavis.edu (Conrad Kwok) (01/06/88)

In article <3790@rosevax.Rosemount.COM> richw@rosevax.Rosemount.COM (Rich Wagenknecht) writes:
>
>The software runs perfectly under QC with in memory compilation but will
>not run when compiled to an executable using QC or MSC 5.0.
>
>Rich W

In QC, the default memory model is M(edium) but in QCL and CL the
default memory model is S(mall). That may cause some problems if you
use any pointer to function. Becasue in QC, the pointer will be far
pointer but in QCL and CL, the pointer will be near. So I would
suggest you to compile the program using /AM under QCL and CL.

Conrad.

dave@westmark.UUCP (Dave Levenson) (01/06/88)

In article <3790@rosevax.Rosemount.COM>, richw@rosevax.Rosemount.COM (Rich Wagenknecht) writes:
...
> I just can't understand
> how my software could run under QC but not as a stand alone executable.
> Has anyone else experienced anything similar?

	This sounds properly frustrating!  I suggest looking for
code that is position-dependent (under QC, you're running at a
different place in memory, aren't you?).

	Another possibility is that QC has left your memory in a
different initial state than MS-DOS does when you run your .exe
directly from command.com.  Perhaps you have an uninitialized
variable somewhere?

	You mentioned that your application makes use of graphics. 
Does QC leave the video subsystem in a different initial state than
MS-DOS does?  Is your program assuming something about its initial
environment?

	Compile it with /Zi and see how far codeview gets with it.
-- 
Dave Levenson
Westmark, Inc.		The man in the Mooney.
Warren, NJ USA
{rutgers | clyde | mtune | ihnp4}!westmark!dave

richw@rosevax.Rosemount.COM (Rich Wagenknecht) (01/06/88)

In article <776@ucdavis.ucdavis.edu>, kwok@iris.ucdavis.edu (Conrad Kwok) writes:
> In article <3790@rosevax.Rosemount.COM> richw@rosevax.Rosemount.COM (Rich Wagenknecht) writes:
> >
> >The software runs perfectly under QC with in memory compilation but will
> >not run when compiled to an executable using QC or MSC 5.0.
> >
> >Rich W
> 
> In QC, the default memory model is M(edium) but in QCL and CL the
> default memory model is S(mall). That may cause some problems if you
> use any pointer to function. Becasue in QC, the pointer will be far
> pointer but in QCL and CL, the pointer will be near. So I would
> suggest you to compile the program using /AM under QCL and CL.
> 
> Conrad.

I've finally been able to get my windowing program to run when compiled
to an executable by a) turning of the optimization options in QC b) not
using the /Ox option in CL. One of the problems appears to be memset
function. When max optimizations are turned on (inline code generation)
memset goes wild. I'm still investigating the problem.

One other note: If you type cl /help you'll see the /On option listed under
optimization options. /On turns off dangerous optimizations. Is there any
MS documentation on what constitutes a 'dangerous' optimization? I wasn't
able to find any.


-- 
Rich W

richw@rosevax.Rosemount.COM
Disclaimer: My views may not represent my own much less my employer's.