You copied the Doc URL to your clipboard.


The __declspec(dllimport) attribute imports a symbol through the dynamic symbol table when linking against DLL libraries.


When an inline function is marked __declspec(dllimport), the function definition in this compilation unit might be inlined, but is never generated out-of-line. An out-of-line call or address reference uses the imported symbol.

__declspec(dllimport) requires the function, variable, or class to have external linkage. You can only use __declspec(dllimport) on functions, variables, and classes with external linkage.

When a class is marked __declspec(dllimport), its static data members and member functions are all imported. When individual static data members and member functions are marked with __declspec(dllimport), only those members are imported.


If you mark a class with __declspec(dllimport), you cannot then mark individual members of that class with __declspec(dllimport).


__declspec(dllimport) int i;
class __declspec(dllimport) X {   void f(); };
Related reference
Was this page helpful? Yes No