#if编译的类库中的DEBUG指令 [英] #if DEBUG directive in compiled class library

查看:97
本文介绍了#if编译的类库中的DEBUG指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将在类库中使用#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?


  1. 库以DEBUG模式编译,应用程序以RELEASE编译

  2. 库以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指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆