Difference in Release & Debug Mode

S

ss

Hi

I built an exe in console debug mode & Release mode . The console
debug mode -exe works fine ...but the release mode EXE starts well but
fails mid way .

The exe is being started as a service. So I need the Release mode EXE.
I've checked the dlls being used . they are working fine for other
services.

Plz Help.


cheers
 
P

Phlip

ss said:
I built an exe in console debug mode & Release mode . The console
debug mode -exe works fine ...but the release mode EXE starts well but
fails mid way .

The exe is being started as a service. So I need the Release mode EXE.
I've checked the dlls being used . they are working fine for other
services.

Edit the Release mode settings, and turn on debugging. Rebuild. Tap <F10>.

But you must take future questions about things like these to newsgroups
that cover VC++ or services. Your questions are too hard for this newsgroup!
 
D

David

How does it fail? The appropriate microsoft.* forums will have a few
more people knowledgeable on why this type of problem occurs.

No. You need the Release verson because you can't release the Debug
version. A Debug version can run as a service.
Edit the Release mode settings, and turn on debugging. Rebuild. Tap <F10>.

This will likely cure the symptom, but definitely not the problem.
Your code has some serious problems. It may not appear to fail in the Debug
version, but it may in time.

There are any number of common mistakes programmers make. Turn on all
warnings and recompile all the code. Look for things like uninitialized
data.
There are more 'obscure' possibilities like timing, but its more likely that
you are seeing one of the dozen or so simple programming mistakes.
But you must take future questions about things like these to newsgroups
that cover VC++ or services. Your questions are too hard for this newsgroup!

David
 
P

Peter van Merkerk

ss said:
I built an exe in console debug mode & Release mode . The console
debug mode -exe works fine ...but the release mode EXE starts well but
fails mid way .

Often when debug builds run fine and release builds fail uninitialized
variables are the cause of the problem. Compile at the maximum warning
level; a source code checker like PC lint may also be useful to track down
this problem.

Note that your question is not about the C++ language, so it is not really
topical here. You better ask this question in a group dedicated to the
development tool you are using (which I guess is Microsoft Visual Studio).
See also: http://www.slack.net/~shiva/welcome.txt
 
P

Phlip

David said:
No. You need the Release verson because you can't release the Debug
version. A Debug version can run as a service.

And you can add __asm { int 3 }; to invoke a hard breakpoint.
This will likely cure the symptom, but definitely not the problem.

It won't cure nothing. It will open the debugger and show source
statements, not disassembly. But the opcodes are compiled in release
mode anyway. You can see what line broke, and what its differences
were with debug mode.
 
D

Dave Townsend

Where does it fail ? You actually need to do
some work to find the location and the cause.
You can try to track down the location by the use
of printf & log files to hone in on the failure spot,
or use message_box() to track down the location
in release mode since the debugger doesn't help much.
Comment out sections of code if you can and see if that
has any effect on the failure.

Common causes of release mode failing :-
( assuming you are using microsoft vc++)

1. ASSERT() statements containing necessary code
statements being optmized/preprocssed out of the
release code. Use VERIFY() instead.

2. Memory is initialized with random patterns in release
mode, this might cause some unpredicted behavior.
Initialize all memory before use.

3. You are using some undefined behavior which behaves
differently in different modes.

4. Mixtures of DLLs for debug/release being used at runtime.
Use the DEPENDS tool to check what dll are being found.
Check the run-time environment when the service is being run
is what you expect it to be.

In years gone by, compiler bugs often were a cause but is
more rare these days, I should assume you have a bug and
not blame the compilers.

dave
 
P

Prateek R Karandikar

Hi

I built an exe in console debug mode & Release mode . The console
debug mode -exe works fine ...but the release mode EXE starts well but
fails mid way .

The exe is being started as a service. So I need the Release mode EXE.
I've checked the dlls being used . they are working fine for other
services.

Plz Help.

"debug mode"??? "release mode"??? Standard C++ has no such things.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
To iterate is human, to recurse divine.
-L. Peter Deutsch
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,170
Messages
2,570,925
Members
47,468
Latest member
Fannie44U3

Latest Threads

Top