Dear friends,
I'm facing a strange problem...
My Application is in Debug mode, and the third party static library
i'm using is in release mode.
When i compile and try to link my application ...
I get a linker error from the third party library as.
Debug information corrupt, recompile the module..... ( from third
party static library)
Is is that using one application in Debug mode and using static
library in release mode gives such type of problems.?
Here actually i'm trying to Debug my application......with third party
library in release mode.....
Any detailed explanation on this would be much helpful.....
Environment: Visual C++ 6.0
Library: static library in release mode......( third party library )
Programming Language: C 5 2437
On Fri, 14 Sep 2007 06:02:37 -0700, sujeet <su********@gmail.com>
wrote in comp.lang.c:
Dear friends,
I'm facing a strange problem...
My Application is in Debug mode, and the third party static library
i'm using is in release mode.
[snip]
You're asking in the wrong place, none of this has anything at all to
do with the C language, which doesn't define "debug mode", "release
mode", or "static library". This is all Windows specific.
Environment: Visual C++ 6.0
Library: static library in release mode......( third party library )
Programming Language: C
Good general purpose Windows programming group
news:comp.os.ms-windows.programmer.win32, or Microsoft's groups in the
news:microsoft.public.vc.* family.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
Jack Klein wrote:
>
You're asking in the wrong place, none of this has anything at all to
do with the C language, which doesn't define "debug mode", "release
mode", or "static library". This is all Windows specific.
<pedantNDEBUG is in the standard, so the OP is not 100% OT </pedant>
Out of curiosity, can anyone think of why a hosted application would
care if NDEBUG was defined or not (I suppose, across the board) in the
library? E.g, is it legal to write something like this:
extern int foo(int x
#ifdef NDEBUG
, ...
#endif
);
in a library header?
Or can a library implement something like this:
int ndebug =
#ifdef NDEBUG
1
#else
0
#endif
;
and an evil API
extern int bar();
extern int baz();
#define foo (ndebug?bar:baz)
Ark Khasin wrote:
Jack Klein wrote:
>> You're asking in the wrong place, none of this has anything at all to do with the C language, which doesn't define "debug mode", "release mode", or "static library". This is all Windows specific.
<pedantNDEBUG is in the standard, so the OP is not 100% OT </pedant>
But the question of the OP did not have any relation to the NDEBUG
macro.
Defining or undefining the NDEBUG macro only affects which
implementation of the assert() macro will be used when you next
#include <assert.h>. In all other respects, NDEBUG is just a regular
macro that C programmers can use.
Out of curiosity, can anyone think of why a hosted application would
care if NDEBUG was defined or not (I suppose, across the board) in the
library? E.g, is it legal to write something like this:
extern int foo(int x
#ifdef NDEBUG
, ...
#endif
);
in a library header?
Yes, that is legal. And it would cause UB if there is a mismatch between
the presence of NDEBUG in the implementation of foo and the use of foo.
Or can a library implement something like this:
int ndebug =
#ifdef NDEBUG
1
#else
0
#endif
;
and an evil API
extern int bar();
extern int baz();
#define foo (ndebug?bar:baz)
Except for the possible multiple definitions of the int ndebug, that
code is perfectly legal.
Bart v Ingen Schenau
--
a.c.l.l.c-c++ FAQ: http://www.comeaucomputing.com/learn/faq
c.l.c FAQ: http://www.eskimo.com/~scs/C-faq/top.html
c.l.c++ FAQ: http://www.parashift.com/c++-faq-lite/
Bart van Ingen Schenau wrote:
Ark Khasin wrote:
>Jack Klein wrote:
>>You're asking in the wrong place, none of this has anything at all to do with the C language, which doesn't define "debug mode", "release mode", or "static library". This is all Windows specific.
<pedantNDEBUG is in the standard, so the OP is not 100% OT </pedant>
But the question of the OP did not have any relation to the NDEBUG
macro.
Defining or undefining the NDEBUG macro only affects which
implementation of the assert() macro will be used when you next
#include <assert.h>. In all other respects, NDEBUG is just a regular
macro that C programmers can use.
>Out of curiosity, can anyone think of why a hosted application would care if NDEBUG was defined or not (I suppose, across the board) in the library? E.g, is it legal to write something like this: extern int foo(int x #ifdef NDEBUG , ... #endif ); in a library header?
Yes, that is legal. And it would cause UB if there is a mismatch between
the presence of NDEBUG in the implementation of foo and the use of foo.
Great. This UB often stops nowadays at the link phase: decent linkers
detect the difference in the function signatures at the use and
definition points. That could be a reason of the OP's link failure,
which is of course a valid form of UB.
So the OP was not *at all* OT, as it turns out. Or, rather, since he
only gave an incomplete definition of the problem by the end of the
posting unit, the posting caused UB in replies.
>
>Or can a library implement something like this: int ndebug = #ifdef NDEBUG 1 #else 0 #endif ; and an evil API extern int bar(); extern int baz(); #define foo (ndebug?bar:baz)
Except for the possible multiple definitions of the int ndebug, that
code is perfectly legal.
I meant of course
lib.c
int ndebug = ...
lib.h
extern int ndebug;
--
Ark
Ark Khasin wrote:
Bart van Ingen Schenau wrote:
>Ark Khasin wrote:
>>Out of curiosity, can anyone think of why a hosted application would care if NDEBUG was defined or not (I suppose, across the board) in the library? E.g, is it legal to write something like this: extern int foo(int x #ifdef NDEBUG , ... #endif ); in a library header?
Yes, that is legal. And it would cause UB if there is a mismatch between the presence of NDEBUG in the implementation of foo and the use of foo.
Great. This UB often stops nowadays at the link phase: decent linkers
detect the difference in the function signatures at the use and
definition points.
Linkers, decent or not, are only able to do that if the compiler encodes
information about function arguments into the name that the linker is
asked to resolve.
Traditionally, C compilers do not perform such encoding, so it is not
guaranteed that a linker (even a decent one) can detect a mismatch in
used and expected parameters.
That could be a reason of the OP's link failure,
which is of course a valid form of UB.
So the OP was not *at all* OT, as it turns out. Or, rather, since he
only gave an incomplete definition of the problem by the end of the
posting unit, the posting caused UB in replies.
The OP asked about a compiler/linker complaint that mentioned the
term 'debug information'.
If a compiler generates debug information or not is not governed by the
use of the NDEBUG macro, but rather by the options provided to the
compiler itself.
Therefor, the question was not about the C language but rather about how
to operate a particular compiler. This makes the question OT for clc.
>
--
Ark
Bart v Ingen Schenau
--
a.c.l.l.c-c++ FAQ: http://www.comeaucomputing.com/learn/faq
c.l.c FAQ: http://c-faq.com/
c.l.c++ FAQ: http://www.parashift.com/c++-faq-lite/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Baskar RajaSekharan |
last post by:
In C-sharp, I wnat to know whether the Component is compiled in Debug Mode
or Run Mode through Code. How is it possible?
Is there any way to Access the Config file and check? Please let me know...
|
by: Pradnyesh Rane |
last post by:
Hi,
I am encountering the following linker error on VC7.
LINK : fatal error LNK1171: unable to load ole32.dll
This error is only encountered for the "Debug" configuration. The project...
|
by: Gustavo L. Fabro |
last post by:
Greetings!
I'm testing VS 2005 Beta 2, and I've compiled a program that
runs just fine on my computer (where VS is installed).
I've tried to run this same program on another computer
(after...
|
by: robin9876 |
last post by:
What are the differences for Compile project as debug instead of
release?
If a project is compiled as release and then needs to be debugged, is
setting the value in web.config debug=true the...
|
by: Seok Bee |
last post by:
Dear Experts,
I've completed my console application and now wants to compile the
application and an executable file to be run at another location. However,
I've tried compiling that program in...
|
by: Abubakar |
last post by:
Hi,
I'm using vs2k5 vc++ (native/unmanaged). I just took a separate copy of a
project from source control (vss) and after fixing its dependencies build it
and it builds fine. But when I try to...
|
by: news.microsoft.com |
last post by:
I have an asp.net 2.0 project that when I change the build configuration to
release I get the following error:
Command line error BC2014: the value 'None' is invalid for option
'debug'.
If I...
|
by: Steve Mauldin |
last post by:
I am posting this again because I never got a solution to this problem.
I have an asp.net 2.0 project that when I change the build configuration to
release I get the following error:
Command...
|
by: Dave Johansen |
last post by:
I just converted a solution from Visual Studio 2003 to Visual Studio
2005 and the Debug mode seems to be running just fine, but the Release
mode crashes on the following code:
std::ifstream...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |