10.24 __declspec(dllimport)

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

Usage

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.

You can only use __declspec(dllimport) on extern functions and variables, and on classes.

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.

Restrictions

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

Examples

__declspec(dllimport) int i;
class __declspec(dllimport) X {   void f(); };
Related reference
10.23 __declspec(dllexport)
Non-Confidential PDF file icon PDF version ARM DUI0472J
Copyright © 2010-2013 ARM. All rights reserved.