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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Compiler-specific Features<br />

When a class is marked __declspec(dllexport), for example,<br />

class __declspec(dllexport) S { ... }; its static data members and member functions<br />

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

marked with __declspec(dllexport), only those members are exported. vtables,<br />

construction vtable tables and RTTI are also exported.<br />

Note<br />

The following declaration is correct:<br />

class __declspec(dllexport) S { ... };<br />

The following declaration is incorrect:<br />

__declspec(dllexport) class S { ... };<br />

In conjunction with --export_all_vtbl, you can use __declspec(notshared) to exempt a<br />

class or structure from having its vtable, construction vtable table and RTTI exported.<br />

--export_all_vtbl and __declspec(dllexport) are typically not used together.<br />

Restrictions<br />

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

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

If you mark a class with __declspec(dllexport), ensure that all of the base classes of<br />

that class are marked __declspec(dllexport).<br />

If you export a virtual function within a class, ensure that you either export all of the<br />

virtual functions in that class, or that you define them inline so that they are visible to<br />

the client.<br />

Example<br />

The __declspec() required in a declaration depends on whether or not the definition is<br />

in the same shared library.<br />

/* This is the declaration for use in the same shared library as the */<br />

/* definition */<br />

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

/* Translation unit containing the definition */<br />

__declspec(dllexport) extern int mymod_get_version(void)<br />

{<br />

return 42;<br />

}<br />

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

ID101213<br />

Non-Confidential,

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

Saved successfully!

Ooh no, something went wrong!