04.01.2015 Views

RealView Compilation Tools - ARM Information Center

RealView Compilation Tools - ARM Information Center

RealView Compilation Tools - ARM Information Center

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Compiler-specific Features<br />

/* This is the declaration for use in a shared library that does not contain */<br />

/* the definition */<br />

__declspec(dllimport) extern int mymod_get_version(void);<br />

As a result of the following macro, a non-defining translation unit in a defining link unit<br />

sees __declspec(dllexport).<br />

/* mymod.h - interface to my module */<br />

#ifdef BUILDING_MYMOD<br />

#define MYMOD_API __declspec(dllexport)<br />

#else /* not BUILDING_MYMOD */<br />

#define MYMOD_API __declspec(dllimport)<br />

#endif<br />

MYMOD_API int mymod_get_version(void);<br />

See also<br />

• __declspec(dllimport)<br />

• __declspec(notshared) on page 4-29<br />

• --export_all_vtbl, --no_export_all_vtbl on page 2-55<br />

• --use_definition_visibility on page 2-95 in the Linker Reference Guide.<br />

4.2.2 __declspec(dllimport)<br />

The __declspec(dllimport) attribute imports a symbol through the dynamic symbol<br />

table when building DLL libraries.<br />

Usage<br />

When an inline function is marked __declspec(dllimport), the function definition in<br />

this compilation unit might be inlined, but is never generated out-of-line. An out-of-line<br />

call or address reference uses the imported symbol.<br />

You can only use __declspec(dllimport) on extern functions and variables, and on<br />

classes.<br />

When a class is marked __declspec(dllimport), its static data members and member<br />

functions are all imported. When individual static data members and member functions<br />

are marked with __declspec(dllimport), only those members are imported.<br />

Restrictions<br />

If you mark a class with __declspec(dllimport), you cannot then mark individual<br />

members of that class with __declspec(dllimport).<br />

4-26 Copyright © 2007-2010 <strong>ARM</strong>. All rights reserved. <strong>ARM</strong> DUI 0348C<br />

Non-Confidential,<br />

ID101213

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!