What is __declspec and when do I need to use it?

前端 未结 6 1186
耶瑟儿~
耶瑟儿~ 2020-11-30 18:08

I have seen instances of __declspec in the code that I am reading. What is it? And when would I need to use this construct?

6条回答
  •  长情又很酷
    2020-11-30 18:22

    It is mostly used for importing symbols from / exporting symbols to a shared library (DLL). Both Visual C++ and GCC compilers support __declspec(dllimport) and __declspec(dllexport). Other uses (some Microsoft-only) are documented in the MSDN.

提交回复
热议问题