| OLD | NEW |
| 1 {{+bindTo:partials.standard_nacl_api}} | 1 {{+bindTo:partials.standard_nacl_api}} |
| 2 | 2 |
| 3 <section id="debugging-with-visual-studio"> | 3 <section id="debugging-with-visual-studio"> |
| 4 <h1 id="debugging-with-visual-studio">Debugging With Visual Studio</h1> | 4 <h1 id="debugging-with-visual-studio">Debugging With Visual Studio</h1> |
| 5 <div class="contents local" id="table-of-contents" style="display: none"> | 5 <div class="contents local" id="table-of-contents" style="display: none"> |
| 6 <p class="topic-title first">Table Of Contents</p> | 6 <p class="topic-title first">Table Of Contents</p> |
| 7 <ul class="small-gap"> | 7 <ul class="small-gap"> |
| 8 <li><a class="reference internal" href="#introduction" id="id1">Introduction</a>
</li> | 8 <li><a class="reference internal" href="#introduction" id="id1">Introduction</a>
</li> |
| 9 <li><p class="first"><a class="reference internal" href="#platforms" id="id2">Pl
atforms</a></p> | 9 <li><p class="first"><a class="reference internal" href="#platforms" id="id2">Pl
atforms</a></p> |
| 10 <ul class="small-gap"> | 10 <ul class="small-gap"> |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 </div><p>Whether you’re porting an existing project or starting from scrat
ch, the Native | 46 </div><p>Whether you’re porting an existing project or starting from scrat
ch, the Native |
| 47 Client Visual Studio add-in makes it easier to set up, build, run and debug | 47 Client Visual Studio add-in makes it easier to set up, build, run and debug |
| 48 your Native Client app by integrating the Native Client SDK development tools | 48 your Native Client app by integrating the Native Client SDK development tools |
| 49 into the Visual Studio environment.</p> | 49 into the Visual Studio environment.</p> |
| 50 <aside class="note"> | 50 <aside class="note"> |
| 51 The Native Client add-in requires Visual Studio 2010 with Service Pack 1. No | 51 The Native Client add-in requires Visual Studio 2010 with Service Pack 1. No |
| 52 other versions of Visual Studio are currently supported. Visual Studio | 52 other versions of Visual Studio are currently supported. Visual Studio |
| 53 Express is also not supported. | 53 Express is also not supported. |
| 54 </aside> | 54 </aside> |
| 55 <section id="introduction"> | |
| 56 <h2 id="introduction">Introduction</h2> | 55 <h2 id="introduction">Introduction</h2> |
| 57 <p>The Native Client add-in for Visual Studio helps you develop your application | 56 <p>The Native Client add-in for Visual Studio helps you develop your application |
| 58 more efficiently in many ways:</p> | 57 more efficiently in many ways:</p> |
| 59 <ul class="small-gap"> | 58 <ul class="small-gap"> |
| 60 <li>Organize and maintain your code as a Visual Studio project.</li> | 59 <li>Organize and maintain your code as a Visual Studio project.</li> |
| 61 <li>Iteratively write and test your application more easily. Visual Studio | 60 <li>Iteratively write and test your application more easily. Visual Studio |
| 62 handles the details of launching a web server to serve your module and run | 61 handles the details of launching a web server to serve your module and run |
| 63 the module in Chrome with a debugger attached.</li> | 62 the module in Chrome with a debugger attached.</li> |
| 64 <li>Compile your module into a dynamically-linked library (DLL) using Visual | 63 <li>Compile your module into a dynamically-linked library (DLL) using Visual |
| 65 Studio’s C/C++ compiler and run it as a Pepper plugin. This allows you to | 64 Studio’s C/C++ compiler and run it as a Pepper plugin. This allows you to |
| 66 develop code incrementally, coding and/or porting one feature at a time into | 65 develop code incrementally, coding and/or porting one feature at a time into |
| 67 the Pepper APIs while continuing to use native Windows APIs that would | 66 the Pepper APIs while continuing to use native Windows APIs that would |
| 68 otherwise be unavailable in an actual Native Client module.</li> | 67 otherwise be unavailable in an actual Native Client module.</li> |
| 69 <li>Use Visual Studio’s built-in debugger to debug your code while it’s ru
nning | 68 <li>Use Visual Studio’s built-in debugger to debug your code while it’s ru
nning |
| 70 as a Pepper plugin.</li> | 69 as a Pepper plugin.</li> |
| 71 <li>Compile your module into a .nexe or .pexe file using the Native Client SDK | 70 <li>Compile your module into a .nexe or .pexe file using the Native Client SDK |
| 72 tools and run it as a bona fide Native Client module.</li> | 71 tools and run it as a bona fide Native Client module.</li> |
| 73 <li>Use the Native Client debugger, nacl-gdb, to test your code when it’s runnin
g | 72 <li>Use the Native Client debugger, nacl-gdb, to test your code when it’s runnin
g |
| 74 as a Native Client object.</li> | 73 as a Native Client object.</li> |
| 75 </ul> | 74 </ul> |
| 76 <p>The add-in defines five new Visual Studio platforms: <code>PPAPI</code>, <cod
e>NaCl32</code>, | 75 <p>The add-in defines five new Visual Studio platforms: <code>PPAPI</code>, <cod
e>NaCl32</code>, |
| 77 <code>NaCl64</code>, <code>NaClARM</code>, and <code>PNaCl</code>. These platfor
ms can be applied to the | 76 <code>NaCl64</code>, <code>NaClARM</code>, and <code>PNaCl</code>. These platfor
ms can be applied to the |
| 78 debug configuration of solutions and projects. The platforms configure the | 77 debug configuration of solutions and projects. The platforms configure the |
| 79 properties of your project so it can be built and run as either a Pepper plugin | 78 properties of your project so it can be built and run as either a Pepper plugin |
| 80 or a Native Client module. The platforms also define the behavior associated | 79 or a Native Client module. The platforms also define the behavior associated |
| 81 with the debug command so you can test your code while running in Visual | 80 with the debug command so you can test your code while running in Visual |
| 82 Studio.</p> | 81 Studio.</p> |
| 83 </section><section id="platforms"> | |
| 84 <h2 id="platforms">Platforms</h2> | 82 <h2 id="platforms">Platforms</h2> |
| 85 <p>It is helpful to consider the Visual Studio add-in platforms in two groups. O
ne | 83 <p>It is helpful to consider the Visual Studio add-in platforms in two groups. O
ne |
| 86 contains the PPAPI platform only. The other group, which we’ll call the Na
tive | 84 contains the PPAPI platform only. The other group, which we’ll call the Na
tive |
| 87 Client platforms, contains platforms that all have “NaCl” in their n
ames: | 85 Client platforms, contains platforms that all have “NaCl” in their n
ames: |
| 88 <code>NaCl32</code>, <code>NaCl64</code>, <code>NaClARM</code>, and <code>PNaCl<
/code>. The diagram below shows the | 86 <code>NaCl32</code>, <code>NaCl64</code>, <code>NaClARM</code>, and <code>PNaCl<
/code>. The diagram below shows the |
| 89 platforms, the ways they are normally used, and the build products they produce.
</p> | 87 platforms, the ways they are normally used, and the build products they produce.
</p> |
| 90 <img alt="/native-client/images/visualstudio4.png" src="/native-client/images/vi
sualstudio4.png" /> | 88 <img alt="/native-client/images/visualstudio4.png" src="/native-client/images/vi
sualstudio4.png" /> |
| 91 <p>Using platforms, your workflow is faster and more efficient. You can compile, | 89 <p>Using platforms, your workflow is faster and more efficient. You can compile, |
| 92 start, and debug your code with one click or key-press. When you press F5, the | 90 start, and debug your code with one click or key-press. When you press F5, the |
| 93 “start debugging” command, Visual Studio automatically launches a web server to | 91 “start debugging” command, Visual Studio automatically launches a web server to |
| 94 serve your module (if necessary) along with an instance of Chrome that runs | 92 serve your module (if necessary) along with an instance of Chrome that runs |
| 95 your Native Client module, and also attaches an appropriate debugger.</p> | 93 your Native Client module, and also attaches an appropriate debugger.</p> |
| 96 <p>You can switch between platforms as you work to compare the behavior of your | 94 <p>You can switch between platforms as you work to compare the behavior of your |
| 97 code.</p> | 95 code.</p> |
| 98 <p>When you run your project, Visual Studio launches the PPAPI and Native Client | 96 <p>When you run your project, Visual Studio launches the PPAPI and Native Client |
| 99 platforms in different ways, as explained in the next sections.</p> | 97 platforms in different ways, as explained in the next sections.</p> |
| 100 <section id="the-ppapi-platform"> | |
| 101 <h3 id="the-ppapi-platform">The PPAPI platform</h3> | 98 <h3 id="the-ppapi-platform">The PPAPI platform</h3> |
| 102 <p>The PPAPI platform builds your module as a dynamic library and launches a | 99 <p>The PPAPI platform builds your module as a dynamic library and launches a |
| 103 version of Chrome that’s configured to run the library as a plugin when it | 100 version of Chrome that’s configured to run the library as a plugin when it |
| 104 encounters an <code><embed></code> element with <code>type=application/x-n
acl</code> (ignoring | 101 encounters an <code><embed></code> element with <code>type=application/x-n
acl</code> (ignoring |
| 105 the information in the manifest file). When running in the PPAPI platform, you | 102 the information in the manifest file). When running in the PPAPI platform, you |
| 106 can use Windows system calls that are unavailable in a regular Native Client | 103 can use Windows system calls that are unavailable in a regular Native Client |
| 107 module built and running as a .nexe file. This offers the ability to port | 104 module built and running as a .nexe file. This offers the ability to port |
| 108 existing code incrementally, rewriting functions using the PPAPI interfaces one | 105 existing code incrementally, rewriting functions using the PPAPI interfaces one |
| 109 piece at a time. Since the module is built with Visual Studio’s native compiler | 106 piece at a time. Since the module is built with Visual Studio’s native compiler |
| 110 (MSBuild) you can use the Visual Studio debugger to control and inspect your | 107 (MSBuild) you can use the Visual Studio debugger to control and inspect your |
| 111 code.</p> | 108 code.</p> |
| 112 </section><section id="the-native-client-platforms"> | |
| 113 <h3 id="the-native-client-platforms">The Native Client platforms</h3> | 109 <h3 id="the-native-client-platforms">The Native Client platforms</h3> |
| 114 <p>There are four Native Client platforms. All of them can be used to build Nati
ve | 110 <p>There are four Native Client platforms. All of them can be used to build Nati
ve |
| 115 Client modules. When you run one of the Native Client platforms Visual Studio | 111 Client modules. When you run one of the Native Client platforms Visual Studio |
| 116 builds the corresponding type of Native Client module (either a .nexe or | 112 builds the corresponding type of Native Client module (either a .nexe or |
| 117 .pexe), starts a web server to serve it up, and launches a copy of Chrome that | 113 .pexe), starts a web server to serve it up, and launches a copy of Chrome that |
| 118 fetches the module from the server and runs it. Visual Studio will also open a | 114 fetches the module from the server and runs it. Visual Studio will also open a |
| 119 terminal window, launch an instance of nacl-gdb, and attach it to your module
217;s | 115 terminal window, launch an instance of nacl-gdb, and attach it to your module
217;s |
| 120 process so you can use gdb commands to debug.</p> | 116 process so you can use gdb commands to debug.</p> |
| 121 <section id="nacl32-and-nacl64"> | |
| 122 <h4 id="nacl32-and-nacl64">NaCl32 and NaCl64</h4> | 117 <h4 id="nacl32-and-nacl64">NaCl32 and NaCl64</h4> |
| 123 <p>The platforms named NaCl32 and NaCl64 are targeted at x86 32-bit and 64-bit | 118 <p>The platforms named NaCl32 and NaCl64 are targeted at x86 32-bit and 64-bit |
| 124 systems respectively. You need both platforms to build a full set of .nexe | 119 systems respectively. You need both platforms to build a full set of .nexe |
| 125 files when you are ready to distribute your application. Note, however, that | 120 files when you are ready to distribute your application. Note, however, that |
| 126 when you are testing in Visual Studio you must select the NaCl64 platform | 121 when you are testing in Visual Studio you must select the NaCl64 platform |
| 127 (because Chrome for Windows runs Native Client in a 64-bit process). If you try | 122 (because Chrome for Windows runs Native Client in a 64-bit process). If you try |
| 128 to run from the NaCl32 platform you will get an error message.</p> | 123 to run from the NaCl32 platform you will get an error message.</p> |
| 129 </section><section id="naclarm"> | |
| 130 <h4 id="naclarm">NaClARM</h4> | 124 <h4 id="naclarm">NaClARM</h4> |
| 131 <p>The NaClARM platform is targeted at ARM-based processors. You can build .nexe | 125 <p>The NaClARM platform is targeted at ARM-based processors. You can build .nexe |
| 132 files with the NaClARM platform in Visual Studio but you cannot run them from | 126 files with the NaClARM platform in Visual Studio but you cannot run them from |
| 133 there. You can use Visual Studio to create a Native Client module that includes | 127 there. You can use Visual Studio to create a Native Client module that includes |
| 134 an ARM-based .nexe file and then run the module from a Chrome browser on an ARM | 128 an ARM-based .nexe file and then run the module from a Chrome browser on an ARM |
| 135 device, such as one of the newer Chromebook computers. See the instructions at | 129 device, such as one of the newer Chromebook computers. See the instructions at |
| 136 <a class="reference internal" href="/native-client/devguide/devcycle/running.htm
l"><em>Running Native Client Applications</em></a> for more information on | 130 <a class="reference internal" href="/native-client/devguide/devcycle/running.htm
l"><em>Running Native Client Applications</em></a> for more information on |
| 137 testing your module in Chrome.</p> | 131 testing your module in Chrome.</p> |
| 138 <aside class="note"> | 132 <aside class="note"> |
| 139 Note: The NaClARM platform currently supports the newlib toolchain only. | 133 Note: The NaClARM platform currently supports the newlib toolchain only. |
| 140 </aside> | 134 </aside> |
| 141 </section><section id="pnacl"> | |
| 142 <h4 id="pnacl">PNaCl</h4> | 135 <h4 id="pnacl">PNaCl</h4> |
| 143 <p>The PNaCl (portable NaCl) platform is included in the Visual Studio Native | 136 <p>The PNaCl (portable NaCl) platform is included in the Visual Studio Native |
| 144 Client add-in versions 1.1 and higher. It supports the .pexe file format. A | 137 Client add-in versions 1.1 and higher. It supports the .pexe file format. A |
| 145 .pexe file encodes your application as bitcode for a low level virtual machine | 138 .pexe file encodes your application as bitcode for a low level virtual machine |
| 146 (LLVM). When you deliver a Native Client application as a PNaCl module, the | 139 (LLVM). When you deliver a Native Client application as a PNaCl module, the |
| 147 manifest file will contain a single .pexe file rather than multiple .nexe | 140 manifest file will contain a single .pexe file rather than multiple .nexe |
| 148 files. The Chrome client transforms the LLVM bitcode into machine instructions | 141 files. The Chrome client transforms the LLVM bitcode into machine instructions |
| 149 for the local system.</p> | 142 for the local system.</p> |
| 150 <p>When you run the PNaCl platform from Visual Studio, Visual Studio uses the | 143 <p>When you run the PNaCl platform from Visual Studio, Visual Studio uses the |
| 151 Native Client SDK to transform the .pexe file into a NaCl64 .nexe file and runs | 144 Native Client SDK to transform the .pexe file into a NaCl64 .nexe file and runs |
| 152 it as if you were working with a NaCl64 platform.</p> | 145 it as if you were working with a NaCl64 platform.</p> |
| 153 <aside class="note"> | 146 <aside class="note"> |
| 154 Note: The PNaCl platform currently supports the newlib toolchain only. | 147 Note: The PNaCl platform currently supports the newlib toolchain only. |
| 155 </aside> | 148 </aside> |
| 156 </section></section></section><section id="installing-the-add-in"> | |
| 157 <h2 id="installing-the-add-in">Installing the add-in</h2> | 149 <h2 id="installing-the-add-in">Installing the add-in</h2> |
| 158 <p>In order to use the Native Client Visual Studio add-in, your development | 150 <p>In order to use the Native Client Visual Studio add-in, your development |
| 159 environment should include:</p> | 151 environment should include:</p> |
| 160 <ul class="small-gap"> | 152 <ul class="small-gap"> |
| 161 <li>A 64-bit version of Windows Vista or Windows 7.</li> | 153 <li>A 64-bit version of Windows Vista or Windows 7.</li> |
| 162 <li>Visual Studio 2010 with Service Pack 1.</li> | 154 <li>Visual Studio 2010 with Service Pack 1.</li> |
| 163 <li><a class="reference external" href="https://www.google.com/intl/en/chrome/br
owser/">Chrome</a> version 23 or | 155 <li><a class="reference external" href="https://www.google.com/intl/en/chrome/br
owser/">Chrome</a> version 23 or |
| 164 greater. You can choose to develop using the latest <a class="reference external
" href="https://www.google.com/intl/en/chrome/browser/canary.html">canary</a> bu
ild of | 156 greater. You can choose to develop using the latest <a class="reference external
" href="https://www.google.com/intl/en/chrome/browser/canary.html">canary</a> bu
ild of |
| 165 Chrome, running the canary version side-by-side with (and separately from) | 157 Chrome, running the canary version side-by-side with (and separately from) |
| 166 your regular version of Chrome.</li> | 158 your regular version of Chrome.</li> |
| 167 <li><a class="reference internal" href="/native-client/sdk/download.html"><em>Th
e Native Client SDK</em></a> with the <code>pepper_23</code> | 159 <li><a class="reference internal" href="/native-client/sdk/download.html"><em>Th
e Native Client SDK</em></a> with the <code>pepper_23</code> |
| 168 bundle or greater. The version of Chrome that you use must be equal or | 160 bundle or greater. The version of Chrome that you use must be equal or |
| 169 greater than the version of the SDK bundle.</li> | 161 greater than the version of the SDK bundle.</li> |
| 170 </ul> | 162 </ul> |
| 171 <section id="set-environment-variables"> | |
| 172 <h3 id="set-environment-variables">Set environment variables</h3> | 163 <h3 id="set-environment-variables">Set environment variables</h3> |
| 173 <p>Before you run the installer you must define two Windows environment variable
s. | 164 <p>Before you run the installer you must define two Windows environment variable
s. |
| 174 They point to the bundle in the Native Client SDK that you use to build your | 165 They point to the bundle in the Native Client SDK that you use to build your |
| 175 module, and to the Chrome browser that you choose to use for debugging.</p> | 166 module, and to the Chrome browser that you choose to use for debugging.</p> |
| 176 <p>To set environment variables in Windows 7, go to the Start menu and search fo
r | 167 <p>To set environment variables in Windows 7, go to the Start menu and search fo
r |
| 177 “environment.” One of the links in the results is “Edit enviro
nment variables | 168 “environment.” One of the links in the results is “Edit enviro
nment variables |
| 178 for your account.” (You can also reach this link from the <code>Control Pa
nel</code> | 169 for your account.” (You can also reach this link from the <code>Control Pa
nel</code> |
| 179 under <code>User Accounts</code>.) Click on the link and use the buttons in the
window | 170 under <code>User Accounts</code>.) Click on the link and use the buttons in the
window |
| 180 to create or change these user variables (the values shown below are only for | 171 to create or change these user variables (the values shown below are only for |
| 181 example):</p> | 172 example):</p> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 193 For example: <code>C:\nacl_sdk\pepper_23</code></td> | 184 For example: <code>C:\nacl_sdk\pepper_23</code></td> |
| 194 </tr> | 185 </tr> |
| 195 <tr class="row-odd"><td>CHROME_PATH</td> | 186 <tr class="row-odd"><td>CHROME_PATH</td> |
| 196 <td>The path to the .exe file for the version of Chrome you | 187 <td>The path to the .exe file for the version of Chrome you |
| 197 are testing with. For example: | 188 are testing with. For example: |
| 198 <code>C:\Users\fred\AppData\Local\Google\Chrome | 189 <code>C:\Users\fred\AppData\Local\Google\Chrome |
| 199 SxS\Application\chrome.exe</code></td> | 190 SxS\Application\chrome.exe</code></td> |
| 200 </tr> | 191 </tr> |
| 201 </tbody> | 192 </tbody> |
| 202 </table> | 193 </table> |
| 203 </section><section id="download-the-add-in"> | |
| 204 <h3 id="download-the-add-in">Download the add-in</h3> | 194 <h3 id="download-the-add-in">Download the add-in</h3> |
| 205 <p>The Native Client Visual Studio add-in is a separate bundle in the SDK named | 195 <p>The Native Client Visual Studio add-in is a separate bundle in the SDK named |
| 206 <code>vs_addin</code>. Open a command prompt window, go to the top-level SDK dir
ectory, | 196 <code>vs_addin</code>. Open a command prompt window, go to the top-level SDK dir
ectory, |
| 207 and run the update command, specifying the add-in bundle:</p> | 197 and run the update command, specifying the add-in bundle:</p> |
| 208 <pre class="prettyprint"> | 198 <pre class="prettyprint"> |
| 209 naclsdk update vs_addin | 199 naclsdk update vs_addin |
| 210 </pre> | 200 </pre> |
| 211 <p>This creates a folder named <code>vs_addin</code>, containing the add-in itse
lf, its | 201 <p>This creates a folder named <code>vs_addin</code>, containing the add-in itse
lf, its |
| 212 installer files, and a directory of examples.</p> | 202 installer files, and a directory of examples.</p> |
| 213 <aside class="note"> | 203 <aside class="note"> |
| 214 Note: The vs_addin bundle is only visible when you run <code>naclsdk</code> on a | 204 Note: The vs_addin bundle is only visible when you run <code>naclsdk</code> on a |
| 215 Windows system. | 205 Windows system. |
| 216 </aside> | 206 </aside> |
| 217 </section><section id="run-the-installer"> | |
| 218 <h3 id="run-the-installer">Run the installer</h3> | 207 <h3 id="run-the-installer">Run the installer</h3> |
| 219 <p>The installer script is located inside the <code>vs_addin</code> folder in th
e SDK. | 208 <p>The installer script is located inside the <code>vs_addin</code> folder in th
e SDK. |
| 220 Right click on the file <code>install.bat</code> and run it as administrator.</p
> | 209 Right click on the file <code>install.bat</code> and run it as administrator.</p
> |
| 221 <p>The script always installs the NativeClient platforms, and asks you if you’d | 210 <p>The script always installs the NativeClient platforms, and asks you if you’d |
| 222 like to install the PPAPI platform as well. You can skip the PPAPI step and run | 211 like to install the PPAPI platform as well. You can skip the PPAPI step and run |
| 223 the installer again later to add the PPAPI platform.</p> | 212 the installer again later to add the PPAPI platform.</p> |
| 224 <p>You can usually run the installer successfully with no arguments. The new | 213 <p>You can usually run the installer successfully with no arguments. The new |
| 225 platforms are installed in <code>C:\Program Files | 214 platforms are installed in <code>C:\Program Files |
| 226 (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms</code>.</p> | 215 (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms</code>.</p> |
| 227 <p>In some cases system resources may not be in their default locations. You mig
ht | 216 <p>In some cases system resources may not be in their default locations. You mig
ht |
| (...skipping 10 matching lines...) Expand all Loading... |
| 238 naclsdk update and run <code>install.bat</code> as administrator.</p> | 227 naclsdk update and run <code>install.bat</code> as administrator.</p> |
| 239 <p>To uninstall the add-in, run <code>install.bat</code> as administrator and ad
d the | 228 <p>To uninstall the add-in, run <code>install.bat</code> as administrator and ad
d the |
| 240 <code>--uninstall</code> flag. You’ll need to run the Command Prompt progr
am as | 229 <code>--uninstall</code> flag. You’ll need to run the Command Prompt progr
am as |
| 241 administrator in order to add the flag. Go the to the Windows start menu, | 230 administrator in order to add the flag. Go the to the Windows start menu, |
| 242 search for “Command Prompt,” right click on the program and run it a
s | 231 search for “Command Prompt,” right click on the program and run it a
s |
| 243 administrator.</p> | 232 administrator.</p> |
| 244 <p>You can verify that the add-in has been installed and determine its version b
y | 233 <p>You can verify that the add-in has been installed and determine its version b
y |
| 245 selecting Add-in Manager in the Visual Studio Tools menu. If the add-in has | 234 selecting Add-in Manager in the Visual Studio Tools menu. If the add-in has |
| 246 been installed it will appear in the list of available add-ins. Select it and | 235 been installed it will appear in the list of available add-ins. Select it and |
| 247 read its description.</p> | 236 read its description.</p> |
| 248 </section></section><section id="try-the-hello-world-gles-sample-project"> | |
| 249 <h2 id="try-the-hello-world-gles-sample-project">Try the <code>hello_world_gles<
/code> sample project</h2> | 237 <h2 id="try-the-hello-world-gles-sample-project">Try the <code>hello_world_gles<
/code> sample project</h2> |
| 250 <p>The add-in comes with an examples directory. Open the sample project | 238 <p>The add-in comes with an examples directory. Open the sample project |
| 251 <code>examples\hello_world_gles\hello_world_gles.sln</code>. This project is an | 239 <code>examples\hello_world_gles\hello_world_gles.sln</code>. This project is an |
| 252 application that displays a spinning cube.</p> | 240 application that displays a spinning cube.</p> |
| 253 <section id="select-the-nacl64-platform"> | |
| 254 <h3 id="select-the-nacl64-platform">Select the NaCl64 platform</h3> | 241 <h3 id="select-the-nacl64-platform">Select the NaCl64 platform</h3> |
| 255 <p>Open the sample project in Visual Studio, select the <code>Configuration Mana
ger</code>, | 242 <p>Open the sample project in Visual Studio, select the <code>Configuration Mana
ger</code>, |
| 256 and confirm that the active solution configuration is <code>Debug</code> and the
active | 243 and confirm that the active solution configuration is <code>Debug</code> and the
active |
| 257 project platform is <code>NaCl64</code>. Note that the platform for the | 244 project platform is <code>NaCl64</code>. Note that the platform for the |
| 258 <code>hello_world_gles</code> project is also <code>NaCl64</code>. (You can get
to the | 245 <code>hello_world_gles</code> project is also <code>NaCl64</code>. (You can get
to the |
| 259 <code>Configuration Manager</code> from the <code>Build</code> menu or the proje
ct’s | 246 <code>Configuration Manager</code> from the <code>Build</code> menu or the proje
ct’s |
| 260 <code>Properties</code> window.)</p> | 247 <code>Properties</code> window.)</p> |
| 261 <img alt="/native-client/images/visualstudio1.png" src="/native-client/images/vi
sualstudio1.png" /> | 248 <img alt="/native-client/images/visualstudio1.png" src="/native-client/images/vi
sualstudio1.png" /> |
| 262 </section><section id="build-and-run-the-project"> | |
| 263 <h3 id="build-and-run-the-project">Build and run the project</h3> | 249 <h3 id="build-and-run-the-project">Build and run the project</h3> |
| 264 <p>Use the debugging command (F5) to build and run the project. As the wheels | 250 <p>Use the debugging command (F5) to build and run the project. As the wheels |
| 265 start to turn, you may be presented with one or more alerts. They are benign; | 251 start to turn, you may be presented with one or more alerts. They are benign; |
| 266 you can accept them and set options to ignore them when that’s possible. Some | 252 you can accept them and set options to ignore them when that’s possible. Some |
| 267 of the messages you might see include:</p> | 253 of the messages you might see include:</p> |
| 268 <ul class="small-gap"> | 254 <ul class="small-gap"> |
| 269 <li>“This project is out of date, would you like to build it?”</li> | 255 <li>“This project is out of date, would you like to build it?”</li> |
| 270 <li>“Please specify the name of the executable file to be used for the deb
ug | 256 <li>“Please specify the name of the executable file to be used for the deb
ug |
| 271 session.” This should be the value of the environment variable CHROME_PATH
, | 257 session.” This should be the value of the environment variable CHROME_PATH
, |
| 272 which is usually supplied as the default value in the dialog.</li> | 258 which is usually supplied as the default value in the dialog.</li> |
| 273 <li>“Debugging information for chrome.exe cannot be found.” This is
to be | 259 <li>“Debugging information for chrome.exe cannot be found.” This is
to be |
| 274 expected, you are debugging your module’s code, not Chrome.</li> | 260 expected, you are debugging your module’s code, not Chrome.</li> |
| 275 <li>“Open file - security warning. The publisher could not be verified.
221; If | 261 <li>“Open file - security warning. The publisher could not be verified.
221; If |
| 276 Visual Studio is complaining about x86_64-nacl-gdb.exe, that’s our debugger. | 262 Visual Studio is complaining about x86_64-nacl-gdb.exe, that’s our debugger. |
| 277 Let it be.</li> | 263 Let it be.</li> |
| 278 </ul> | 264 </ul> |
| 279 <p>Once you’ve passed these hurdles, the application starts to run and you’ll se
e | 265 <p>Once you’ve passed these hurdles, the application starts to run and you’ll se
e |
| 280 activity in three places:</p> | 266 activity in three places:</p> |
| 281 <ol class="arabic simple"> | 267 <ol class="arabic simple"> |
| 282 <li>A terminal window opens running <code>nacl-gdb</code>.</li> | 268 <li>A terminal window opens running <code>nacl-gdb</code>.</li> |
| 283 <li>Chrome launches running your module in a tab.</li> | 269 <li>Chrome launches running your module in a tab.</li> |
| 284 <li>The Visual Studio output window displays debugging messages when you select | 270 <li>The Visual Studio output window displays debugging messages when you select |
| 285 the debug output item. | 271 the debug output item. |
| 286 Stop the debugging session by closing the Chrome window, or select the stop | 272 Stop the debugging session by closing the Chrome window, or select the stop |
| 287 debugging command from the debug menu. The nacl-gdb window will close when | 273 debugging command from the debug menu. The nacl-gdb window will close when |
| 288 you stop running the program.</li> | 274 you stop running the program.</li> |
| 289 </ol> | 275 </ol> |
| 290 </section><section id="test-the-nacl-gdb-debugger"> | |
| 291 <h3 id="test-the-nacl-gdb-debugger">Test the nacl-gdb debugger</h3> | 276 <h3 id="test-the-nacl-gdb-debugger">Test the nacl-gdb debugger</h3> |
| 292 <p>Add a breakpoint at the SwapBuffers call in the function MainLoop, which is i
n | 277 <p>Add a breakpoint at the SwapBuffers call in the function MainLoop, which is i
n |
| 293 hello_world.cc.</p> | 278 hello_world.cc.</p> |
| 294 <img alt="/native-client/images/visualstudio2.png" src="/native-client/images/vi
sualstudio2.png" /> | 279 <img alt="/native-client/images/visualstudio2.png" src="/native-client/images/vi
sualstudio2.png" /> |
| 295 <p>Start the debugger again (F5). This time the existing breakpoint is loaded in
to | 280 <p>Start the debugger again (F5). This time the existing breakpoint is loaded in
to |
| 296 nacl-gcb and the program will pause there. Type c to continue running. You can | 281 nacl-gcb and the program will pause there. Type c to continue running. You can |
| 297 use gdb commands to set more breakpoints and step through the application. For | 282 use gdb commands to set more breakpoints and step through the application. For |
| 298 details, see <a class="reference internal" href="/native-client/devguide/devcycl
e/debugging.html#using-gdb"><em>Debugging with nacl-gdb</em></a> (scroll down to
the end | 283 details, see <a class="reference internal" href="/native-client/devguide/devcycl
e/debugging.html#using-gdb"><em>Debugging with nacl-gdb</em></a> (scroll down to
the end |
| 299 of the section to see some commonly used gdb commands).</p> | 284 of the section to see some commonly used gdb commands).</p> |
| 300 </section><section id="test-the-visual-studio-debugger"> | |
| 301 <h3 id="test-the-visual-studio-debugger">Test the Visual Studio debugger</h3> | 285 <h3 id="test-the-visual-studio-debugger">Test the Visual Studio debugger</h3> |
| 302 <p>If you’ve installed the <code>PPAPI</code> platform, go back to the <code>Con
figuration | 286 <p>If you’ve installed the <code>PPAPI</code> platform, go back to the <code>Con
figuration |
| 303 Manager</code> and select the <code>PPAPI</code> platform. This time when Chrome
launches the | 287 Manager</code> and select the <code>PPAPI</code> platform. This time when Chrome
launches the |
| 304 <code>nacl-gdb</code> window will not appear; the Visual Studio debugger is full
y | 288 <code>nacl-gdb</code> window will not appear; the Visual Studio debugger is full
y |
| 305 engaged and on the job.</p> | 289 engaged and on the job.</p> |
| 306 </section><section id="inspect-the-platform-properties"> | |
| 307 <h3 id="inspect-the-platform-properties">Inspect the platform properties</h3> | 290 <h3 id="inspect-the-platform-properties">Inspect the platform properties</h3> |
| 308 <p>At this point, it may be helpful to take a look at the properties that are | 291 <p>At this point, it may be helpful to take a look at the properties that are |
| 309 associated with the PPAPI and Native Client platforms—see the settings in
the | 292 associated with the PPAPI and Native Client platforms—see the settings in
the |
| 310 sample project as an example.</p> | 293 sample project as an example.</p> |
| 311 </section></section><section id="developing-for-native-client-in-visual-studio"> | |
| 312 <h2 id="developing-for-native-client-in-visual-studio">Developing for Native Cli
ent in Visual Studio</h2> | 294 <h2 id="developing-for-native-client-in-visual-studio">Developing for Native Cli
ent in Visual Studio</h2> |
| 313 <p>After you’ve installed the add-in and tried the sample project, you’re ready
to | 295 <p>After you’ve installed the add-in and tried the sample project, you’re ready
to |
| 314 start working with your own code. You can reuse the sample project and the | 296 start working with your own code. You can reuse the sample project and the |
| 315 PPAPI and Native Client platforms it already has by replacing the source code | 297 PPAPI and Native Client platforms it already has by replacing the source code |
| 316 with your own. More likely, you will add the platforms to an existing project, | 298 with your own. More likely, you will add the platforms to an existing project, |
| 317 or to a new project that you create from scratch.</p> | 299 or to a new project that you create from scratch.</p> |
| 318 <section id="adding-platforms-to-a-project"> | |
| 319 <h3 id="adding-platforms-to-a-project">Adding platforms to a project</h3> | 300 <h3 id="adding-platforms-to-a-project">Adding platforms to a project</h3> |
| 320 <p>Follow these steps to add the Native Client and PPAPI platforms to a project:
</p> | 301 <p>Follow these steps to add the Native Client and PPAPI platforms to a project:
</p> |
| 321 <ol class="arabic simple"> | 302 <ol class="arabic simple"> |
| 322 <li>Open the Configuration Manager.</li> | 303 <li>Open the Configuration Manager.</li> |
| 323 <li>On the row corresponding to your project, click the Platform column dropdown | 304 <li>On the row corresponding to your project, click the Platform column dropdown |
| 324 menu and select <code><New...></code>.</li> | 305 menu and select <code><New...></code>.</li> |
| 325 <li>Select <code>PPAPI</code>, <code>NaCl32</code>, <code>NaCl64</code>, or <cod
e>PNaCl</code> from the New platform | 306 <li>Select <code>PPAPI</code>, <code>NaCl32</code>, <code>NaCl64</code>, or <cod
e>PNaCl</code> from the New platform |
| 326 menu.</li> | 307 menu.</li> |
| 327 <li>In most cases, you should select <code><Empty></code> in the “Copy set
tings from” | 308 <li>In most cases, you should select <code><Empty></code> in the “Copy set
tings from” |
| 328 menu. <strong>Never copy settings between ``PPAPI``, ``NaCl32``, ``NaCl64``, | 309 menu. <strong>Never copy settings between ``PPAPI``, ``NaCl32``, ``NaCl64``, |
| 329 ``NaClARM``, or ``PNaCl`` platforms</strong>. You can copy settings from a Win32 | 310 ``NaClARM``, or ``PNaCl`` platforms</strong>. You can copy settings from a Win32 |
| 330 platform, if one exists, but afterwards be sure that the project properties | 311 platform, if one exists, but afterwards be sure that the project properties |
| 331 are properly set for the new platform, as mentioned in step 6 below.</li> | 312 are properly set for the new platform, as mentioned in step 6 below.</li> |
| 332 <li>If you like, check the “Create new solutions platform” box to create a | 313 <li>If you like, check the “Create new solutions platform” box to create a |
| 333 solution platform in addition to a project platform. (This is optional, but | 314 solution platform in addition to a project platform. (This is optional, but |
| 334 it can be convenient since it lets you switch project platforms from the | 315 it can be convenient since it lets you switch project platforms from the |
| 335 Visual Studio main window by selecting the solution platform that has the | 316 Visual Studio main window by selecting the solution platform that has the |
| 336 same name.)</li> | 317 same name.)</li> |
| 337 <li>Review the project properties for the new platform you just added. In most | 318 <li>Review the project properties for the new platform you just added. In most |
| 338 cases, the default properties for each platform should be correct, but it | 319 cases, the default properties for each platform should be correct, but it |
| 339 pays to check. Be especially careful about custom properties you may have | 320 pays to check. Be especially careful about custom properties you may have |
| 340 set beforehand, or copied from a Win32 platform. Also confirm that the | 321 set beforehand, or copied from a Win32 platform. Also confirm that the |
| 341 Configuration type is correct:<ul class="small-gap"> | 322 Configuration type is correct:<ul class="small-gap"> |
| 342 <li><code>Dynamic Library</code> for <code>PPAPI</code></li> | 323 <li><code>Dynamic Library</code> for <code>PPAPI</code></li> |
| 343 <li><code>Application (.pexe)</code> for <code>PNaCl</code></li> | 324 <li><code>Application (.pexe)</code> for <code>PNaCl</code></li> |
| 344 <li><code>Application (.nexe)</code> for <code>NaCl32</code>, <code>NaCl64</code
>, and <code>NaClARM</code></li> | 325 <li><code>Application (.nexe)</code> for <code>NaCl32</code>, <code>NaCl64</code
>, and <code>NaClARM</code></li> |
| 345 </ul> | 326 </ul> |
| 346 </li> | 327 </li> |
| 347 </ol> | 328 </ol> |
| 348 </section><section id="selecting-a-toolchain"> | |
| 349 <h3 id="selecting-a-toolchain">Selecting a toolchain</h3> | 329 <h3 id="selecting-a-toolchain">Selecting a toolchain</h3> |
| 350 <p>When you build a Native Client module directly from the SDK you can use two | 330 <p>When you build a Native Client module directly from the SDK you can use two |
| 351 different toolchains, newlib or glibc. See <a class="reference internal" href="/
native-client/devguide/devcycle/dynamic-loading.html"><em>Dynamic Linking and Lo
ading | 331 different toolchains, newlib or glibc. See <a class="reference internal" href="/
native-client/devguide/devcycle/dynamic-loading.html"><em>Dynamic Linking and Lo
ading |
| 352 with glibc</em></a> for a description of the two toolchains and | 332 with glibc</em></a> for a description of the two toolchains and |
| 353 instructions on how to build and deploy an application with the glibc | 333 instructions on how to build and deploy an application with the glibc |
| 354 toolchain. The Native Client platforms offer you the same toolchain choice. You | 334 toolchain. The Native Client platforms offer you the same toolchain choice. You |
| 355 can specify which toolchain to use in the project properties, under | 335 can specify which toolchain to use in the project properties, under |
| 356 <code>Configuration Properties > General > Native Client > Toolchain</c
ode>.</p> | 336 <code>Configuration Properties > General > Native Client > Toolchain</c
ode>.</p> |
| 357 <aside class="note"> | 337 <aside class="note"> |
| 358 Currently, the NaClARM and PNaCl platforms only support the newlib toolchain. | 338 Currently, the NaClARM and PNaCl platforms only support the newlib toolchain. |
| 359 </aside> | 339 </aside> |
| 360 <p>There is no toolchain property for the PPAPI platform. The PPAPI platform use
s | 340 <p>There is no toolchain property for the PPAPI platform. The PPAPI platform use
s |
| 361 the toolchain and libraries that come with Visual Studio.</p> | 341 the toolchain and libraries that come with Visual Studio.</p> |
| 362 </section><section id="adding-libraries-to-a-project"> | |
| 363 <h3 id="adding-libraries-to-a-project">Adding libraries to a project</h3> | 342 <h3 id="adding-libraries-to-a-project">Adding libraries to a project</h3> |
| 364 <p>If your Native Client application requires libraries that are not included in | 343 <p>If your Native Client application requires libraries that are not included in |
| 365 the SDK you must add them to the project properties (under <code>Configuration | 344 the SDK you must add them to the project properties (under <code>Configuration |
| 366 Properties > Linker > Input > Additional Dependencies</code>), just lik
e any other | 345 Properties > Linker > Input > Additional Dependencies</code>), just lik
e any other |
| 367 Visual Studio project. This list of dependencies is a semi-colon delimited | 346 Visual Studio project. This list of dependencies is a semi-colon delimited |
| 368 list. On the PPAPI platform the library names include the .lib extension (e.g., | 347 list. On the PPAPI platform the library names include the .lib extension (e.g., |
| 369 <code>ppapi_cpp.lib;ppapi.lib</code>). On the Native Client platforms the extens
ion is | 348 <code>ppapi_cpp.lib;ppapi.lib</code>). On the Native Client platforms the extens
ion is |
| 370 excluded (e.g., <code>ppapi_cpp;ppapi</code>).</p> | 349 excluded (e.g., <code>ppapi_cpp;ppapi</code>).</p> |
| 371 </section><section id="running-a-web-server"> | |
| 372 <h3 id="running-a-web-server">Running a web server</h3> | 350 <h3 id="running-a-web-server">Running a web server</h3> |
| 373 <p>In order for the Visual Studio add-in to test your Native Client module, you | 351 <p>In order for the Visual Studio add-in to test your Native Client module, you |
| 374 must serve the module from a web server. There are two options:</p> | 352 must serve the module from a web server. There are two options:</p> |
| 375 <section id="running-your-own-server"> | |
| 376 <h4 id="running-your-own-server">Running your own server</h4> | 353 <h4 id="running-your-own-server">Running your own server</h4> |
| 377 <p>When you start a debug run Visual Studio launches Chrome and tries to connect | 354 <p>When you start a debug run Visual Studio launches Chrome and tries to connect |
| 378 to the web server at the address found in the Chrome command arguments (see the | 355 to the web server at the address found in the Chrome command arguments (see the |
| 379 project’s Debugging > Command configuration property), which is usually | 356 project’s Debugging > Command configuration property), which is usually |
| 380 <code>localhost:$(NaClWebServerPort)</code>. If you are using your own server be
sure to | 357 <code>localhost:$(NaClWebServerPort)</code>. If you are using your own server be
sure to |
| 381 specify its address in the command arguments property, and confirm that your | 358 specify its address in the command arguments property, and confirm that your |
| 382 server is running before starting a debug session. Also be certain that the | 359 server is running before starting a debug session. Also be certain that the |
| 383 server has all the files it needs to deliver a Native Client module (see | 360 server has all the files it needs to deliver a Native Client module (see |
| 384 “Keeping track of all the pieces”, below).</p> | 361 “Keeping track of all the pieces”, below).</p> |
| 385 </section><section id="running-the-sdk-server"> | |
| 386 <h4 id="running-the-sdk-server">Running the SDK server</h4> | 362 <h4 id="running-the-sdk-server">Running the SDK server</h4> |
| 387 <p>If there is no web server running at the specified port, Visual Studio will t
ry | 363 <p>If there is no web server running at the specified port, Visual Studio will t
ry |
| 388 to launch the simple Python web server that comes with the Native Client SDK. | 364 to launch the simple Python web server that comes with the Native Client SDK. |
| 389 It looks for a copy of the server in the SDK itself (at | 365 It looks for a copy of the server in the SDK itself (at |
| 390 <code>%NACL_SDK_ROOT%\tools\httpd.py</code>), and in the project directory | 366 <code>%NACL_SDK_ROOT%\tools\httpd.py</code>), and in the project directory |
| 391 (<code>$(ProjectDir)/httpd.py</code>). If the server exists in one of those loca
tions, | 367 (<code>$(ProjectDir)/httpd.py</code>). If the server exists in one of those loca
tions, |
| 392 Visual Studio launches the server. The server output appears in Visual Studio’s | 368 Visual Studio launches the server. The server output appears in Visual Studio’s |
| 393 Output window, in the pane named “Native Client Web Server Output”. A server | 369 Output window, in the pane named “Native Client Web Server Output”. A server |
| 394 launched in this way is terminated when the debugging session ends.</p> | 370 launched in this way is terminated when the debugging session ends.</p> |
| 395 </section></section><section id="keeping-track-of-all-the-pieces"> | |
| 396 <h3 id="keeping-track-of-all-the-pieces">Keeping track of all the pieces</h3> | 371 <h3 id="keeping-track-of-all-the-pieces">Keeping track of all the pieces</h3> |
| 397 <p>No matter where the web server lives or how it’s launched you must make sure | 372 <p>No matter where the web server lives or how it’s launched you must make sure |
| 398 that it has all the files that your application needs:</p> | 373 that it has all the files that your application needs:</p> |
| 399 <ul class="small-gap"> | 374 <ul class="small-gap"> |
| 400 <li>All Native Client applications must have an <a class="reference internal" hr
ef="/native-client/devguide/coding/application-structure.html#html-file"><em>htm
l host page</em></a>. This file is typically called <code>index.html</code>. The
host page | 375 <li>All Native Client applications must have an <a class="reference internal" hr
ef="/native-client/devguide/coding/application-structure.html#html-file"><em>htm
l host page</em></a>. This file is typically called <code>index.html</code>. The
host page |
| 401 must have an embed tag with its type attribute set to | 376 must have an embed tag with its type attribute set to |
| 402 <code>application-type/x-nacl</code>. If you plan to use a Native Client platfor
m the | 377 <code>application-type/x-nacl</code>. If you plan to use a Native Client platfor
m the |
| 403 embed tag must also include a src attribute pointing to a Native Client | 378 embed tag must also include a src attribute pointing to a Native Client |
| 404 manifest (.mnf) file.</li> | 379 manifest (.mnf) file.</li> |
| 405 <li>If you are using a Native Client platform you must include a valid | 380 <li>If you are using a Native Client platform you must include a valid |
| (...skipping 20 matching lines...) Expand all Loading... |
| 426 <p>You can look at the example projects in the SDK to see how the index and | 401 <p>You can look at the example projects in the SDK to see how the index and |
| 427 manifest files are organized. The example project <code>hello_nacl</code> has a | 402 manifest files are organized. The example project <code>hello_nacl</code> has a |
| 428 subdirectory also called <code>hello_nacl</code>. That folder contains <code>ind
ex.html</code> | 403 subdirectory also called <code>hello_nacl</code>. That folder contains <code>ind
ex.html</code> |
| 429 and <code>hello_nacl.nmf</code>. The nexe file is found in | 404 and <code>hello_nacl.nmf</code>. The nexe file is found in |
| 430 <code>NaCl64\newlib\Debug\hello_nacl_64.nexe</code>. The <code>hello_world_gles<
/code> example | 405 <code>NaCl64\newlib\Debug\hello_nacl_64.nexe</code>. The <code>hello_world_gles<
/code> example |
| 431 project contains a subdirectory called <cite>hello_world_gles`</cite>. That dire
ctory | 406 project contains a subdirectory called <cite>hello_world_gles`</cite>. That dire
ctory |
| 432 contains html files built with both toolchains (<code>index_glibc.html</code> an
d | 407 contains html files built with both toolchains (<code>index_glibc.html</code> an
d |
| 433 <code>index_newlib.html</code>). The .nexe and .nmf files are found in the newli
b and | 408 <code>index_newlib.html</code>). The .nexe and .nmf files are found in the newli
b and |
| 434 glibc subfolders. For additional information about the parts of a Native Client | 409 glibc subfolders. For additional information about the parts of a Native Client |
| 435 application, see <a class="reference internal" href="/native-client/devguide/cod
ing/application-structure.html"><em>Application Structure</em></a>.</p> | 410 application, see <a class="reference internal" href="/native-client/devguide/cod
ing/application-structure.html"><em>Application Structure</em></a>.</p> |
| 436 </section><section id="using-the-debuggers"> | |
| 437 <h3 id="using-the-debuggers">Using the debuggers</h3> | 411 <h3 id="using-the-debuggers">Using the debuggers</h3> |
| 438 <p>PPAPI plugins are built natively by Visual Studio’s compiler (MSBuild), and | 412 <p>PPAPI plugins are built natively by Visual Studio’s compiler (MSBuild), and |
| 439 work with Visual Studio’s debugger in the usual way. You can set breakpoints in | 413 work with Visual Studio’s debugger in the usual way. You can set breakpoints in |
| 440 the Visual Studio source code files before you begin debugging, and on-the-fly | 414 the Visual Studio source code files before you begin debugging, and on-the-fly |
| 441 while running the program.</p> | 415 while running the program.</p> |
| 442 <p>NaCl32 and NaClARM executables (.nexe files) cannot be run or debugged from | 416 <p>NaCl32 and NaClARM executables (.nexe files) cannot be run or debugged from |
| 443 Visual Studio.</p> | 417 Visual Studio.</p> |
| 444 <p>NaCl64 executables (.nexe files) are compiled using one of the Native Client | 418 <p>NaCl64 executables (.nexe files) are compiled using one of the Native Client |
| 445 toolchains in the SDK, which create an <a class="reference external" href="`http
://en.wikipedia.org/wiki/Executable_and_Linkable_Format">ELF-formatted</a> execu
table. To | 419 toolchains in the SDK, which create an <a class="reference external" href="`http
://en.wikipedia.org/wiki/Executable_and_Linkable_Format">ELF-formatted</a> execu
table. To |
| 446 debug a running .nexe you must use nacl-gdb, which is a command line debugger | 420 debug a running .nexe you must use nacl-gdb, which is a command line debugger |
| (...skipping 10 matching lines...) Expand all Loading... |
| 457 gdb commands).</p> | 431 gdb commands).</p> |
| 458 <p>Note that you can’t use the Start Without Debugging command (Ctrl+F5) with a | 432 <p>Note that you can’t use the Start Without Debugging command (Ctrl+F5) with a |
| 459 project in the Debug configuration. If you do, Chrome will hang because the | 433 project in the Debug configuration. If you do, Chrome will hang because the |
| 460 Debug platform launches Chrome with the command argument | 434 Debug platform launches Chrome with the command argument |
| 461 <code>--wait-for-debugger-children</code> (in PPAPI) or <code>--enable-nacl-debu
g</code> (in a | 435 <code>--wait-for-debugger-children</code> (in PPAPI) or <code>--enable-nacl-debu
g</code> (in a |
| 462 Native Client platform). These flags cause Chrome to pause and wait for a | 436 Native Client platform). These flags cause Chrome to pause and wait for a |
| 463 debugger to attach. If you use the Start Without Debugging command, no debugger | 437 debugger to attach. If you use the Start Without Debugging command, no debugger |
| 464 attaches and Chrome just waits patiently. To use Start Without Debugging, | 438 attaches and Chrome just waits patiently. To use Start Without Debugging, |
| 465 switch to the Release configuration, or manually remove the offending argument | 439 switch to the Release configuration, or manually remove the offending argument |
| 466 from the <code>Command Arguments</code> property.</p> | 440 from the <code>Command Arguments</code> property.</p> |
| 467 </section><section id="disable-chrome-caching"> | |
| 468 <h3 id="disable-chrome-caching">Disable Chrome caching</h3> | 441 <h3 id="disable-chrome-caching">Disable Chrome caching</h3> |
| 469 <p>When you debug with a Native Client platform you might want to <a class="refe
rence internal" href="/native-client/devguide/devcycle/running.html#cache"><em>d
isable | 442 <p>When you debug with a Native Client platform you might want to <a class="refe
rence internal" href="/native-client/devguide/devcycle/running.html#cache"><em>d
isable |
| 470 Chrome’s cache</em></a> to be sure you are testing your latest and greates
t | 443 Chrome’s cache</em></a> to be sure you are testing your latest and greates
t |
| 471 code.</p> | 444 code.</p> |
| 472 </section><section id="a-warning-about-postmessage"> | |
| 473 <h3 id="a-warning-about-postmessage">A warning about PostMessage</h3> | 445 <h3 id="a-warning-about-postmessage">A warning about PostMessage</h3> |
| 474 <p>Some Windows libraries define the symbol <code>PostMessage</code> as <code>Po
stMessageW</code>. | 446 <p>Some Windows libraries define the symbol <code>PostMessage</code> as <code>Po
stMessageW</code>. |
| 475 This can cause havoc if you are working with the PPAPI platform and you use the | 447 This can cause havoc if you are working with the PPAPI platform and you use the |
| 476 Pepper <code>PostMessage()</code> call in your module. Some Pepper API header fi
les | 448 Pepper <code>PostMessage()</code> call in your module. Some Pepper API header fi
les |
| 477 contain a self-defensive fix that you might need yourself, while you are | 449 contain a self-defensive fix that you might need yourself, while you are |
| 478 testing on the PPAPI platform. Here it is:</p> | 450 testing on the PPAPI platform. Here it is:</p> |
| 479 <pre class="prettyprint"> | 451 <pre class="prettyprint"> |
| 480 // If Windows defines PostMessage, undef it. | 452 // If Windows defines PostMessage, undef it. |
| 481 #ifdef PostMessage | 453 #ifdef PostMessage |
| 482 #undef PostMessage | 454 #undef PostMessage |
| 483 #endif | 455 #endif |
| 484 </pre> | 456 </pre> |
| 485 </section><section id="porting-windows-applications-to-native-client-in-visual-s
tudio"> | |
| 486 <h3 id="porting-windows-applications-to-native-client-in-visual-studio">Porting
Windows applications to Native Client in Visual Studio</h3> | 457 <h3 id="porting-windows-applications-to-native-client-in-visual-studio">Porting
Windows applications to Native Client in Visual Studio</h3> |
| 487 <p>At Google I/O 2012 we demonstrated how to port a Windows desktop application
to | 458 <p>At Google I/O 2012 we demonstrated how to port a Windows desktop application
to |
| 488 Native Client in 60 minutes. The <a class="reference external" href="http://www.
youtube.com/watch?v=1zvhs5FR0X8&feature=plcp">video</a> is available to | 459 Native Client in 60 minutes. The <a class="reference external" href="http://www.
youtube.com/watch?v=1zvhs5FR0X8&feature=plcp">video</a> is available to |
| 489 watch on YouTube. The <code>vs_addin/examples</code> folder contains a pair of s
imple | 460 watch on YouTube. The <code>vs_addin/examples</code> folder contains a pair of s
imple |
| 490 examples that demonstrate porting process. They are designed to be completed | 461 examples that demonstrate porting process. They are designed to be completed |
| 491 in just 5 minutes. The two examples are called <code>hello_nacl</code> and | 462 in just 5 minutes. The two examples are called <code>hello_nacl</code> and |
| 492 <code>hello_nacl_cpp</code>. They are essentially the same, but the former uses
the C | 463 <code>hello_nacl_cpp</code>. They are essentially the same, but the former uses
the C |
| 493 PPAPI interface while the latter uses the C++ API. The application is the | 464 PPAPI interface while the latter uses the C++ API. The application is the |
| 494 familiar “Hello, World.”</p> | 465 familiar “Hello, World.”</p> |
| 495 <p>Each example begins with the Windows desktop version running in the <code>Win
32</code> | 466 <p>Each example begins with the Windows desktop version running in the <code>Win
32</code> |
| 496 platform. From there you move to the <code>PPAPI</code> platform, where you perf
orm a | 467 platform. From there you move to the <code>PPAPI</code> platform, where you perf
orm a |
| 497 series of steps to set up the Native Client framework, use it to run the | 468 series of steps to set up the Native Client framework, use it to run the |
| 498 desktop version, and then port the behavior from Windows calls to the PPAPI | 469 desktop version, and then port the behavior from Windows calls to the PPAPI |
| 499 interface. You wind up with a program that uses no Windows functions, which | 470 interface. You wind up with a program that uses no Windows functions, which |
| 500 can run in either the <code>PPAPI</code> or the <code>NaCl64</code> platform.</p
> | 471 can run in either the <code>PPAPI</code> or the <code>NaCl64</code> platform.</p
> |
| 501 <p>The example projects use a single source file (<code>hello_nacl.c</code> or | 472 <p>The example projects use a single source file (<code>hello_nacl.c</code> or |
| 502 <code>hello_nacl_cpp.cpp</code>). Each step in the porting process is accomplish
ed by | 473 <code>hello_nacl_cpp.cpp</code>). Each step in the porting process is accomplish
ed by |
| 503 progressively defining the symbols STEP1 through STEP6 in the source. Inline | 474 progressively defining the symbols STEP1 through STEP6 in the source. Inline |
| 504 comments explain how each successive step changes the code. View the example | 475 comments explain how each successive step changes the code. View the example |
| 505 code to see how it’s actually done. Here is a summary of the process:</p> | 476 code to see how it’s actually done. Here is a summary of the process:</p> |
| 506 <section id="win32-platform"> | |
| 507 <h4 id="win32-platform">Win32 Platform</h4> | 477 <h4 id="win32-platform">Win32 Platform</h4> |
| 508 <dl class="docutils"> | 478 <dl class="docutils"> |
| 509 <dt>STEP1 Run the desktop application</dt> | 479 <dt>STEP1 Run the desktop application</dt> |
| 510 <dd>Begin by running the original Windows application in the Win32 platform.</dd
> | 480 <dd>Begin by running the original Windows application in the Win32 platform.</dd
> |
| 511 </dl> | 481 </dl> |
| 512 </section><section id="ppapi-platform"> | |
| 513 <h4 id="ppapi-platform">PPAPI Platform</h4> | 482 <h4 id="ppapi-platform">PPAPI Platform</h4> |
| 514 <dl class="docutils"> | 483 <dl class="docutils"> |
| 515 <dt>STEP2 Launch Chrome with an empty Native Client module</dt> | 484 <dt>STEP2 Launch Chrome with an empty Native Client module</dt> |
| 516 <dd>Switch to the PPAPI platform and include the code required to initialize a | 485 <dd>Switch to the PPAPI platform and include the code required to initialize a |
| 517 Native Module instance. The code is bare-boned, it does nothing but | 486 Native Module instance. The code is bare-boned, it does nothing but |
| 518 initialize the module. This step illustrates how Visual Studio handles all | 487 initialize the module. This step illustrates how Visual Studio handles all |
| 519 the details of launching a web-server and Chrome, and running the Native | 488 the details of launching a web-server and Chrome, and running the Native |
| 520 Client module as a Pepper plugin.</dd> | 489 Client module as a Pepper plugin.</dd> |
| 521 <dt>STEP3 Run the desktop application synchronously from the Native Client modul
e</dt> | 490 <dt>STEP3 Run the desktop application synchronously from the Native Client modul
e</dt> |
| 522 <dd>The Native Client creates the window directly and then calls WndProc to run | 491 <dd>The Native Client creates the window directly and then calls WndProc to run |
| 523 the desktop application. Since WndProc spins in its message loop, the call to | 492 the desktop application. Since WndProc spins in its message loop, the call to |
| 524 initialize the module never returns. Close the Hello World window and the | 493 initialize the module never returns. Close the Hello World window and the |
| 525 module initialization will finish.</dd> | 494 module initialization will finish.</dd> |
| 526 <dt>STEP4 Running the desktop application and Native Client asynchronously</dt> | 495 <dt>STEP4 Running the desktop application and Native Client asynchronously</dt> |
| 527 <dd>In WndProc replace the message loop with a callback function. Now the app | 496 <dd>In WndProc replace the message loop with a callback function. Now the app |
| 528 window and the Native Client module are running concurrently.</dd> | 497 window and the Native Client module are running concurrently.</dd> |
| 529 <dt>STEP5 Redirect output to the web page</dt> | 498 <dt>STEP5 Redirect output to the web page</dt> |
| 530 <dd>The module initialization code calls initInstanceInBrowserWindow rather than | 499 <dd>The module initialization code calls initInstanceInBrowserWindow rather than |
| 531 initInstanceInPCWindow. WndProc is no longer used. Instead, postMessage is | 500 initInstanceInPCWindow. WndProc is no longer used. Instead, postMessage is |
| 532 called to place text (now “Hello, Native Client”) in the web page ra
ther than | 501 called to place text (now “Hello, Native Client”) in the web page ra
ther than |
| 533 opening and writing to a window. Once you’ve reached this step you can sta
rt | 502 opening and writing to a window. Once you’ve reached this step you can sta
rt |
| 534 porting pieces of the application one feature at a time.</dd> | 503 porting pieces of the application one feature at a time.</dd> |
| 535 <dt>STEP6 Remove all the Windows code</dt> | 504 <dt>STEP6 Remove all the Windows code</dt> |
| 536 <dd>All the Windows code is def’d out, proving we are PPAPI-compliant. The | 505 <dd>All the Windows code is def’d out, proving we are PPAPI-compliant. The |
| 537 functional code that is running is the same as STEP5.</dd> | 506 functional code that is running is the same as STEP5.</dd> |
| 538 </dl> | 507 </dl> |
| 539 </section><section id="nacl64-platform"> | |
| 540 <h4 id="nacl64-platform">NaCl64 Platform</h4> | 508 <h4 id="nacl64-platform">NaCl64 Platform</h4> |
| 541 <dl class="docutils"> | 509 <dl class="docutils"> |
| 542 <dt>Run the Native Client Module in the NaCl64 platform</dt> | 510 <dt>Run the Native Client Module in the NaCl64 platform</dt> |
| 543 <dd>You are still running the STEP6 code, but as a Native Client module rather | 511 <dd>You are still running the STEP6 code, but as a Native Client module rather |
| 544 than a Pepper plugin.</dd> | 512 than a Pepper plugin.</dd> |
| 545 </dl> | 513 </dl> |
| 546 </section></section></section></section> | 514 </section> |
| 547 | 515 |
| 548 {{/partials.standard_nacl_api}} | 516 {{/partials.standard_nacl_api}} |
| OLD | NEW |