Debugging .ARX in C++

Debugging .ARX in C++

mycad2016D8W4P
Enthusiast Enthusiast
2,088 Views
3 Replies
Message 1 of 4

Debugging .ARX in C++

mycad2016D8W4P
Enthusiast
Enthusiast

Hi,

 

I'm new to ObjectARX. In order to debug my code, I built the .arx file in debug configuration. Seems it was able to debug, and worked well with the AutoCAD product which is built in release. Is it the normal way to debug the .arx? Any potential problems about debug dll working with release exe? What should I take care of? Perhaps it is not question for ObjectARX. I'm just curious how ObjectARX make the debugging work.  

 

Thanks.

0 Likes
2,089 Views
3 Replies
Replies (3)
Message 2 of 4

mycad2016D8W4P
Enthusiast
Enthusiast
Im using vs 2015.
0 Likes
Message 3 of 4

tbrammer
Advisor
Advisor

When you are debugging the acad.exe is the executable - and acad.exe is compiled and linked in release mode. So it uses release versions of runtime DLLs, MFC and so on. If your ARX/DBX/DLL is build as debug-version it might need additional instances of these debug-DLLs. This will at least reduce performance and waste resources - it could also lead to problems.

 

Your debug builds should always link against release libraries. _DEBUG should be undefined at least while windows and MFC/ATL headers are included because these headers will force library linkage like this: 

 

#ifdef _DEBUG
  #pragma comment( lib, "<debug-lib>")
#else
   #pragma comment( lib, "<release-lib>")
#endif

If you use _DEBUG you should use a precompiled header, include all system headers in stdafx.h and enclose critical includes like this:

 

#if defined(_DEBUG)
  #define _DEBUG_WAS_DEFINED
  #undef _DEBUG
#endif

<critical includes here>

#ifdef _DEBUG_WAS_DEFINED
  #define _DEBUG
#undef _DEBUG_WAS_DEFINED

The only drawback of using realease libraries I know is, that the build-in functions to track memory leaks won't work as they do in full debug builds.


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

Message 4 of 4

mycad2016D8W4P
Enthusiast
Enthusiast

Thanks. If I only user ObjectArx objects, don't user third party libraries, what should I take care of for debugging my code?

0 Likes