如何检测#Import dll

How to detect #import of a DLL?

本文关键字:#Import dll 检测 何检测      更新时间:2023-10-16

我们希望根据是否针对特定的DLL执行#import在代码周围进行一些条件编译。如果有#define创建的符号,可以很容易地测试,但是我们没有找到任何符号。

A.H:

#ifdef ... // what goes here?
    // do something with testing.dll
#else
    // do some alternate stuff
#endif

x.cpp:

#import "testing.dll"
#include "A.h"

y.cpp:

#include "A.h"

我不认为这是可以实现的,这就是为什么:在编译时间在编译器宏解决时,在运行时加载了DLL,因此,在我的理解中,我认为您无法实现此行为。