问题描述
我将在类库中使用#if DEBUG指令。编译后的ClassLibrary.dll将在单独的Application.exe中使用。
I am going to use #if DEBUG directive in a class library. The compiled ClassLibrary.dll will be used in a separate Application.exe.
在以下情况下,将执行该类库中的调试代码吗?
Will my debug code from this class library be executed in the following situations?
- 库以DEBUG模式编译,应用程序以RELEASE编译
- 库以RELEASE编译,应用程序以DEBUG
推荐答案
编译器指令在编译时而不是在运行时进行解释。因此,无论使用的应用程序是在RELEASE还是DEBUG模式下编译的,都没有关系。因此,
A compiler directive is interpreted at compile time and not at runtime. Therefore it does not matter, if the using application is compiled in RELEASE or DEBUG mode. Therefore
1。)库是在DEBUG模式下编译的,应用程序是在RELEASE => 是
1.) library is compiled in DEBUG mode, application is compiled in RELEASE => Yes
2。)库是在RELEASE中编译的,应用程序是在DEBUG中编译的=> 否
2.) library is compiled in RELEASE, application is compiled in DEBUG => No
这篇关于#if编译的类库中的DEBUG指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!