枚举是否应该从dll中导出? [英] Should enums be exported out of dll or not?

查看:248
本文介绍了枚举是否应该从dll中导出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在处理的项目(以cpp为单位)从dll导出 enum 类型。在导出时,我们遇到了一些问题,所以我想问一些与导出 枚举类型有关的问题。

The project (in cpp) we are working on exports enum types from the dll. In exporting we are having some issues so I wanted to ask something related to exporting enum type.

我认为枚举的行为类似于种类常量,因此它们不会为用户提供任何功能。那么,我们可以省略枚举的导出吗?

I think that enum's behave like 'kind of' constants, so they do not provide any 'functionality' to the user. So, can we omit the exporting of enum's ?

OR

枚举提供给最终用户的某些功能(不是表现为常量),使得有必要将其导出?

Are there some functionalities (other than behaving as constants) that the enum's provide to the end-user that makes it necessary to export them ?

更多详细信息:

我们有一个包含以下代码的头文件:

We have a header file containing following piece of code:

enum DECL_BASE logical_state
{
    LOGICAL_TRUE,
    LOGICAL_FALSE,
    LOGICAL_DEFAULT
};

//DECL_BASE is __declspec(dllexport)

没有警告或错误。我只是想知道导出此内容的用途。

This code compiles fine with no warnings or errors. I just wanted to know that what is/are the use(s) of exporting this.

谢谢

推荐答案

通常使用dll的枚举和常量来调用dll的导出接口,我们只需要在提供的dll的头文件中声明这些枚举和常量即可。

Usually for using the enums and constants of a dll, for calling the exported interfaces of the dll, we only have to declare those enums and constants in the provided dll's header file(s). No export calling convention is needed for them.

如果上述注释不能解决您的问题,请进一步说明您的问题。

Please give more clarity to your issue, if the above comment doesn't solve your problem.

这篇关于枚举是否应该从dll中导出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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