将某些 header 文件编译成 DLL (Visual Studio 2010 C++)

Compile certain header files into DLL (Visual Studio 2010 C++ )

我有一个 visual studio 项目,我在其中编写了一个测量系统的接口。整个项目由不同的 类 和 header 文件和实现组成。 当我编译 dll 时,我只需要主要 header 来使用 dll。

示例:

MainClass.h
HelperClassA.h
HelperClassB.h
AnotherClassA.h
AnotherClassB.h

MainClass.cpp
HelperClassA.cpp
HelperClassB.cpp
AnotherClassA.cpp
AnotherClassB.cpp

当我编译 MainClass.dll 时,我只想交付带有 dll 的 MainClass.h 而没有其他 header。 这有可能吗?

此外,我使用了一些 boost 库 header 文件,是否也可以将它们包含到 dll 中,以便使用 dll 的用户不必安装 boost 或拥有 header 个文件?

When I compile MainClass.dll I want just to deliver MainClass.h with the dll without the other headers. Is this somehow possible?

如果您的 MainClass.h 不包含任何 header,那么这是可能的。例如,如果其他 header 仅包含在您的 MainClass.cpp 文件中。

可能就是这种情况。

Further i use some boost library header files, is it also possible to include them into the dll so that the user using the dll doesn't have to install boost or to have the header files?

对于boostheader,和上面说的一样。对于任何链接的 boost 库,我相信可以在您的 DLL 中包含静态库。我相信不可能将 DLL 包含在其他 DLL 中。