Should enums be exported out of dll or not?

余生颓废 提交于 2019-12-12 13:17:21

问题


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 ?

More details :

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.

Thanks


回答1:


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.



来源:https://stackoverflow.com/questions/40400469/should-enums-be-exported-out-of-dll-or-not

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!