iotivity 0.9.0
[platform/upstream/iotivity.git] / service / protocol-plugin / lib / cpluff / doc / reference / c-api / group__symbolVisibility.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3 <title>C-Pluff C API: Symbol visibility</title>
4 <link href="doxygen.css" rel="stylesheet" type="text/css">
5 <link href="tabs.css" rel="stylesheet" type="text/css">
6 </head><body>
7 <!-- Generated by Doxygen 1.5.1 -->
8 <div class="tabs">
9   <ul>
10     <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
11     <li><a href="modules.html"><span>Modules</span></a></li>
12     <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
13     <li><a href="files.html"><span>Files</span></a></li>
14     <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
15   </ul></div>
16 <h1>Symbol visibility<br>
17 <small>
18 [<a class="el" href="group__cDefines.html">Defines</a>]</small>
19 </h1><hr><a name="_details"></a><h2>Detailed Description</h2>
20 Macros for controlling inter-module symbol visibility and linkage. 
21 <p>
22 These macros have platform specific values. <a class="el" href="group__symbolVisibility.html#ga2e3768d73167e12c2330e4b96bcbd70">CP_EXPORT</a>, <a class="el" href="group__symbolVisibility.html#gb44eb8224723b45a1c909177bdd7bc32">CP_IMPORT</a> and <a class="el" href="group__symbolVisibility.html#gf58571664980e1a0d2b0bee413296492">CP_HIDDEN</a> can be reused by plug-in implementations for better portability. The complexity is mostly due to Windows DLL exports and imports.<p>
23 <a class="anchor" name="symbolVisibilityExample"></a> Each module should usually define its own macro to declare API symbols with <a class="el" href="group__symbolVisibility.html#ga2e3768d73167e12c2330e4b96bcbd70">CP_EXPORT</a> and <a class="el" href="group__symbolVisibility.html#gb44eb8224723b45a1c909177bdd7bc32">CP_IMPORT</a> as necessary. For example, a mobule could define a macro <code>MY_API</code> in the API header file as follows.<p>
24 <div class="fragment"><pre class="fragment"><span class="preprocessor"> #ifndef MY_API</span>
25 <span class="preprocessor"></span><span class="preprocessor"> #  define MY_API CP_IMPORT</span>
26 <span class="preprocessor"> #endif</span>
27 </pre></div><p>
28 By default the API symbols would then be marked for import which is correct when client modules are including the API header file. When compiling the module itself the option <code>-DMY_API=CP_EXPORT</code> would be passed to the compiler to override the API header file and to mark the API symbols for export. The overriding definition could also be included in module source files or in an internal header file before including the API header file. 
29 <p>
30 <table border="0" cellpadding="0" cellspacing="0">
31 <tr><td></td></tr>
32 <tr><td colspan="2"><br><h2>Defines</h2></td></tr>
33 <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__symbolVisibility.html#ga2e3768d73167e12c2330e4b96bcbd70">CP_EXPORT</a></td></tr>
34
35 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Declares a symbol to be exported for inter-module usage.  <a href="#ga2e3768d73167e12c2330e4b96bcbd70"></a><br></td></tr>
36 <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__symbolVisibility.html#gb44eb8224723b45a1c909177bdd7bc32">CP_IMPORT</a></td></tr>
37
38 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Declares a symbol to be imported from another module.  <a href="#gb44eb8224723b45a1c909177bdd7bc32"></a><br></td></tr>
39 <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__symbolVisibility.html#gf58571664980e1a0d2b0bee413296492">CP_HIDDEN</a></td></tr>
40
41 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Declares a symbol hidden from other modules.  <a href="#gf58571664980e1a0d2b0bee413296492"></a><br></td></tr>
42 </table>
43 <hr><h2>Define Documentation</h2>
44 <a class="anchor" name="ga2e3768d73167e12c2330e4b96bcbd70"></a><!-- doxytag: member="cpluffdef.h::CP_EXPORT" ref="ga2e3768d73167e12c2330e4b96bcbd70" args="" -->
45 <div class="memitem">
46 <div class="memproto">
47       <table class="memname">
48         <tr>
49           <td class="memname">#define CP_EXPORT          </td>
50         </tr>
51       </table>
52 </div>
53 <div class="memdoc">
54
55 <p>
56 Declares a symbol to be exported for inter-module usage. 
57 <p>
58 When compiling the module which defines the symbol this macro should be placed at the start of the symbol declaration to ensure that the symbol is exported to other modules. However, when compiling other modules the declaration of the symbol should start with <a class="el" href="group__symbolVisibility.html#gb44eb8224723b45a1c909177bdd7bc32">CP_IMPORT</a>. See <a class="el" href="group__symbolVisibility.html#symbolVisibilityExample">the example</a> of how to do this. 
59 </div>
60 </div><p>
61 <a class="anchor" name="gb44eb8224723b45a1c909177bdd7bc32"></a><!-- doxytag: member="cpluffdef.h::CP_IMPORT" ref="gb44eb8224723b45a1c909177bdd7bc32" args="" -->
62 <div class="memitem">
63 <div class="memproto">
64       <table class="memname">
65         <tr>
66           <td class="memname">#define CP_IMPORT          </td>
67         </tr>
68       </table>
69 </div>
70 <div class="memdoc">
71
72 <p>
73 Declares a symbol to be imported from another module. 
74 <p>
75 When compiling a module which uses the symbol this macro should be placed at the start of the symbol declaration to ensure that the symbol is imported from the defining module. However, when compiling the defining module the declaration of the symbol should start with <a class="el" href="group__symbolVisibility.html#ga2e3768d73167e12c2330e4b96bcbd70">CP_EXPORT</a>. See <a class="el" href="group__symbolVisibility.html#symbolVisibilityExample">the example</a> of how to do this. 
76 </div>
77 </div><p>
78 <a class="anchor" name="gf58571664980e1a0d2b0bee413296492"></a><!-- doxytag: member="cpluffdef.h::CP_HIDDEN" ref="gf58571664980e1a0d2b0bee413296492" args="" -->
79 <div class="memitem">
80 <div class="memproto">
81       <table class="memname">
82         <tr>
83           <td class="memname">#define CP_HIDDEN          </td>
84         </tr>
85       </table>
86 </div>
87 <div class="memdoc">
88
89 <p>
90 Declares a symbol hidden from other modules. 
91 <p>
92 This macro should be placed at the start of the symbol declaration to hide the symbol from other modules (if supported by the platform). This macro is not intended to be used with symbols declared as "static" which are already internal to the object file. Some platforms do not support hiding of symbols and therefore unique prefixes should be used for global symbols internal to the module even when they are declared using this macro. 
93 </div>
94 </div><p>
95 <hr size="1">
96 <p class="footer">
97 <a href="http://www.c-pluff.org/">C-Pluff</a>, a plug-in framework for C<br>
98 Copyright 2007 <a href="http://www.jlehtinen.net/">Johannes Lehtinen</a>
99 </p>
100 <p class="generated-by">
101 Generated on Fri Apr 6 15:40:55 2007 for C-Pluff C API by&nbsp;<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1
102 </p>
103 </body>
104 </html>