1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"[]>
2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5    <meta http-equiv="Content-Style-Type" content="text/css" />
6    <link rel="stylesheet" href="../css/manpage.css" type="text/css" />
7    <style type="text/css">
8      <!--
9      span.static_style
10      {
11        font-size			: 8pt;
12        color				: white;
13        font-weight			: bold;
14        background			: #44f;
15        border-left			: solid 1px #aaf;
16        border-top			: solid 1px #aaf;
17        border-right		: solid 1px #00c;
18        border-bottom		: solid 1px #00c;
19        padding-left		: 2px;
20        padding-right		: 2px;
21      }
22
23      span.virtual_style
24      {
25        font-size			 : 8pt;
26        color				 : white;
27        font-weight			: bold;
28        background			: #0a0;
29        border-left			: solid 1px #0f0;
30        border-top			: solid 1px #0f0;
31        border-right		: solid 1px #060;
32        border-bottom		: solid 1px #060;
33        padding-left		: 2px;
34        padding-right		: 2px;
35      }
36
37      span.protected_style
38      {
39        font-size			 : 8pt;
40        color				 : white;
41        font-weight			: bold;
42        background			: #444;
43        border-left			: solid 1px #ccc;
44        border-top			: solid 1px #ccc;
45        border-right		: solid 1px #222;
46        border-bottom		: solid 1px #222;
47        padding-left		: 2px;
48        padding-right		: 2px;
49      }
50        -->
51    </style>
52<title>C-Language Wrappers</title>
53  </head>
54  <body>
55<h1>C-Language Wrappers</h1>
56<h2>Description</h2>
57    <div class="section">
58<p>The CTR-SDK APIs are mostly written in C++. C++ APIs cannot be called directly from C-language files.</p>
59<p>The CTR-SDK therefore provides wrappers that allow you to call the C++ APIs from C source files.</p>
60    </div>
61<h3>Mutex Example</h3>
62    <div class="section">
63<p>In C++, you would use the <a href="../nn/os/Mutex/Overview.html"><CODE>nn::os::Mutex</CODE></a> class to use mutexes. The mutex class maintains mutex objects internally.</p>
64<p>The names of the wrappers that allow this class to be used in C begin with <CODE>nnosMutex</CODE>, as shown in the examples below. These functions have a 1:1 correspondence with the C++ methods.</p>
65      <p>
66<itemizedlist><listitem><para><a href="../nn_os_Mutex_c/nnosMutexInitialize.html"><CODE>nnosMutexInitialize</CODE></a> → <a href="../nn/os/Mutex/Initialize.html"><CODE>nn::os::Mutex::Initialize</CODE></a><br /></para></listitem> <listitem><para><a href="../nn_os_Mutex_c/nnosMutexLock.html"><CODE>nnosMutexLock</CODE></a> → <a href="../nn/os/Mutex/Lock.html"><CODE>nn::os::Mutex::Lock</CODE></a><br /></para></listitem> <listitem><para><a href="../nn_os_Mutex_c/nnosMutexTryLock.html"><CODE>nnosMutexTryLock</CODE></a> → <a href="../nn/os/Mutex/TryLock.html"><CODE>nn::os::Mutex::TryLock</CODE></a><br /></para></listitem> <listitem><para><a href="../nn_os_Mutex_c/nnosMutexUnlock.html"><CODE>nnosMutexUnlock</CODE></a> → <a href="../nn/os/Mutex/Unlock.html"><CODE>nn::os::Mutex::Unlock</CODE></a><br /></para></listitem> <listitem><para><a href="../nn_os_Mutex_c/nnosMutexInitialize.html"><CODE>nnosMutexInitialize</CODE></a> → <a href="../nn/os/Mutex/Initialize.html"><CODE>nn::os::Mutex::Initialize</CODE></a><br /></para></listitem></itemizedlist> Refer to the documentation for the corresponding class methods for the details of the C wrapper functions.</p>
67<p>The <a href="../nnosMutex/Overview.html"><CODE>nnosMutex</CODE></a> structure, the data type that stores mutex objects in C, is an exception. This structure is actually a class instance under the hood, so it cannot be referenced directly from the C language.</p>
68    </div>
69<h3>List</h3>
70    <div class="section">
71<p>See the &quot;Modules&quot; page for a list of modules that can be used in C and C++ code respectively.</p>
72      <!-- write here -->
73    </div>
74<h2>Revision History</h2>
75    <div class="section">
76      <dl class="history">
77        <dt>2010/01/07</dt>
78<dd>Initial version.<br /></dd>
79      </dl>
80    </div>
81  <hr><p>CONFIDENTIAL</p></body>
82</html>