You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

278 lines
12KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1991-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3
  6. or any later version published by the Free Software Foundation;
  7. with no Invariant Sections, with no Front-Cover Texts, and with no
  8. Back-Cover Texts. A copy of the license is included in the
  9. section entitled "GNU Free Documentation License".
  10. -->
  11. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  12. <head>
  13. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  14. <title>windres (GNU Binary Utilities)</title>
  15. <meta name="description" content="windres (GNU Binary Utilities)">
  16. <meta name="keywords" content="windres (GNU Binary Utilities)">
  17. <meta name="resource-type" content="document">
  18. <meta name="distribution" content="global">
  19. <meta name="Generator" content="makeinfo">
  20. <link href="index.html#Top" rel="start" title="Top">
  21. <link href="Binutils-Index.html#Binutils-Index" rel="index" title="Binutils Index">
  22. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  23. <link href="index.html#Top" rel="up" title="Top">
  24. <link href="dlltool.html#dlltool" rel="next" title="dlltool">
  25. <link href="windmc.html#windmc" rel="prev" title="windmc">
  26. <style type="text/css">
  27. <!--
  28. a.summary-letter {text-decoration: none}
  29. blockquote.indentedblock {margin-right: 0em}
  30. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  31. blockquote.smallquotation {font-size: smaller}
  32. div.display {margin-left: 3.2em}
  33. div.example {margin-left: 3.2em}
  34. div.lisp {margin-left: 3.2em}
  35. div.smalldisplay {margin-left: 3.2em}
  36. div.smallexample {margin-left: 3.2em}
  37. div.smalllisp {margin-left: 3.2em}
  38. kbd {font-style: oblique}
  39. pre.display {font-family: inherit}
  40. pre.format {font-family: inherit}
  41. pre.menu-comment {font-family: serif}
  42. pre.menu-preformatted {font-family: serif}
  43. pre.smalldisplay {font-family: inherit; font-size: smaller}
  44. pre.smallexample {font-size: smaller}
  45. pre.smallformat {font-family: inherit; font-size: smaller}
  46. pre.smalllisp {font-size: smaller}
  47. span.nolinebreak {white-space: nowrap}
  48. span.roman {font-family: initial; font-weight: normal}
  49. span.sansserif {font-family: sans-serif; font-weight: normal}
  50. ul.no-bullet {list-style: none}
  51. -->
  52. </style>
  53. </head>
  54. <body lang="en">
  55. <a name="windres"></a>
  56. <div class="header">
  57. <p>
  58. Next: <a href="dlltool.html#dlltool" accesskey="n" rel="next">dlltool</a>, Previous: <a href="windmc.html#windmc" accesskey="p" rel="prev">windmc</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Binutils-Index.html#Binutils-Index" title="Index" rel="index">Index</a>]</p>
  59. </div>
  60. <hr>
  61. <a name="windres-1"></a>
  62. <h2 class="chapter">12 windres</h2>
  63. <p><code>windres</code> may be used to manipulate Windows resources.
  64. </p>
  65. <blockquote>
  66. <p><em>Warning:</em> <code>windres</code> is not always built as part of the binary
  67. utilities, since it is only useful for Windows targets.
  68. </p></blockquote>
  69. <div class="smallexample">
  70. <pre class="smallexample">windres [options] [input-file] [output-file]
  71. </pre></div>
  72. <p><code>windres</code> reads resources from an input file and copies them into
  73. an output file. Either file may be in one of three formats:
  74. </p>
  75. <dl compact="compact">
  76. <dt><code>rc</code></dt>
  77. <dd><p>A text format read by the Resource Compiler.
  78. </p>
  79. </dd>
  80. <dt><code>res</code></dt>
  81. <dd><p>A binary format generated by the Resource Compiler.
  82. </p>
  83. </dd>
  84. <dt><code>coff</code></dt>
  85. <dd><p>A COFF object or executable.
  86. </p></dd>
  87. </dl>
  88. <p>The exact description of these different formats is available in
  89. documentation from Microsoft.
  90. </p>
  91. <p>When <code>windres</code> converts from the <code>rc</code> format to the <code>res</code>
  92. format, it is acting like the Windows Resource Compiler. When
  93. <code>windres</code> converts from the <code>res</code> format to the <code>coff</code>
  94. format, it is acting like the Windows <code>CVTRES</code> program.
  95. </p>
  96. <p>When <code>windres</code> generates an <code>rc</code> file, the output is similar
  97. but not identical to the format expected for the input. When an input
  98. <code>rc</code> file refers to an external filename, an output <code>rc</code> file
  99. will instead include the file contents.
  100. </p>
  101. <p>If the input or output format is not specified, <code>windres</code> will
  102. guess based on the file name, or, for the input file, the file contents.
  103. A file with an extension of <samp>.rc</samp> will be treated as an <code>rc</code>
  104. file, a file with an extension of <samp>.res</samp> will be treated as a
  105. <code>res</code> file, and a file with an extension of <samp>.o</samp> or
  106. <samp>.exe</samp> will be treated as a <code>coff</code> file.
  107. </p>
  108. <p>If no output file is specified, <code>windres</code> will print the resources
  109. in <code>rc</code> format to standard output.
  110. </p>
  111. <p>The normal use is for you to write an <code>rc</code> file, use <code>windres</code>
  112. to convert it to a COFF object file, and then link the COFF file into
  113. your application. This will make the resources described in the
  114. <code>rc</code> file available to Windows.
  115. </p>
  116. <dl compact="compact">
  117. <dt><code>-i <var>filename</var></code></dt>
  118. <dt><code>--input <var>filename</var></code></dt>
  119. <dd><p>The name of the input file. If this option is not used, then
  120. <code>windres</code> will use the first non-option argument as the input file
  121. name. If there are no non-option arguments, then <code>windres</code> will
  122. read from standard input. <code>windres</code> can not read a COFF file from
  123. standard input.
  124. </p>
  125. </dd>
  126. <dt><code>-o <var>filename</var></code></dt>
  127. <dt><code>--output <var>filename</var></code></dt>
  128. <dd><p>The name of the output file. If this option is not used, then
  129. <code>windres</code> will use the first non-option argument, after any used
  130. for the input file name, as the output file name. If there is no
  131. non-option argument, then <code>windres</code> will write to standard output.
  132. <code>windres</code> can not write a COFF file to standard output. Note,
  133. for compatibility with <code>rc</code> the option <samp>-fo</samp> is also
  134. accepted, but its use is not recommended.
  135. </p>
  136. </dd>
  137. <dt><code>-J <var>format</var></code></dt>
  138. <dt><code>--input-format <var>format</var></code></dt>
  139. <dd><p>The input format to read. <var>format</var> may be &lsquo;<samp>res</samp>&rsquo;, &lsquo;<samp>rc</samp>&rsquo;, or
  140. &lsquo;<samp>coff</samp>&rsquo;. If no input format is specified, <code>windres</code> will
  141. guess, as described above.
  142. </p>
  143. </dd>
  144. <dt><code>-O <var>format</var></code></dt>
  145. <dt><code>--output-format <var>format</var></code></dt>
  146. <dd><p>The output format to generate. <var>format</var> may be &lsquo;<samp>res</samp>&rsquo;,
  147. &lsquo;<samp>rc</samp>&rsquo;, or &lsquo;<samp>coff</samp>&rsquo;. If no output format is specified,
  148. <code>windres</code> will guess, as described above.
  149. </p>
  150. </dd>
  151. <dt><code>-F <var>target</var></code></dt>
  152. <dt><code>--target <var>target</var></code></dt>
  153. <dd><p>Specify the BFD format to use for a COFF file as input or output. This
  154. is a BFD target name; you can use the <samp>--help</samp> option to see a list
  155. of supported targets. Normally <code>windres</code> will use the default
  156. format, which is the first one listed by the <samp>--help</samp> option.
  157. <a href="Target-Selection.html#Target-Selection">Target Selection</a>.
  158. </p>
  159. </dd>
  160. <dt><code>--preprocessor <var>program</var></code></dt>
  161. <dd><p>When <code>windres</code> reads an <code>rc</code> file, it runs it through the C
  162. preprocessor first. This option may be used to specify the preprocessor
  163. to use, including any leading arguments. The default preprocessor
  164. argument is <code>gcc -E -xc-header -DRC_INVOKED</code>.
  165. </p>
  166. </dd>
  167. <dt><code>--preprocessor-arg <var>option</var></code></dt>
  168. <dd><p>When <code>windres</code> reads an <code>rc</code> file, it runs it through
  169. the C preprocessor first. This option may be used to specify additional
  170. text to be passed to preprocessor on its command line.
  171. This option can be used multiple times to add multiple options to the
  172. preprocessor command line.
  173. </p>
  174. </dd>
  175. <dt><code>-I <var>directory</var></code></dt>
  176. <dt><code>--include-dir <var>directory</var></code></dt>
  177. <dd><p>Specify an include directory to use when reading an <code>rc</code> file.
  178. <code>windres</code> will pass this to the preprocessor as an <samp>-I</samp>
  179. option. <code>windres</code> will also search this directory when looking for
  180. files named in the <code>rc</code> file. If the argument passed to this command
  181. matches any of the supported <var>formats</var> (as described in the <samp>-J</samp>
  182. option), it will issue a deprecation warning, and behave just like the
  183. <samp>-J</samp> option. New programs should not use this behaviour. If a
  184. directory happens to match a <var>format</var>, simple prefix it with &lsquo;<samp>./</samp>&rsquo;
  185. to disable the backward compatibility.
  186. </p>
  187. </dd>
  188. <dt><code>-D <var>target</var></code></dt>
  189. <dt><code>--define <var>sym</var>[=<var>val</var>]</code></dt>
  190. <dd><p>Specify a <samp>-D</samp> option to pass to the preprocessor when reading an
  191. <code>rc</code> file.
  192. </p>
  193. </dd>
  194. <dt><code>-U <var>target</var></code></dt>
  195. <dt><code>--undefine <var>sym</var></code></dt>
  196. <dd><p>Specify a <samp>-U</samp> option to pass to the preprocessor when reading an
  197. <code>rc</code> file.
  198. </p>
  199. </dd>
  200. <dt><code>-r</code></dt>
  201. <dd><p>Ignored for compatibility with rc.
  202. </p>
  203. </dd>
  204. <dt><code>-v</code></dt>
  205. <dd><p>Enable verbose mode. This tells you what the preprocessor is if you
  206. didn&rsquo;t specify one.
  207. </p>
  208. </dd>
  209. <dt><code>-c <var>val</var></code></dt>
  210. <dt><code>--codepage <var>val</var></code></dt>
  211. <dd><p>Specify the default codepage to use when reading an <code>rc</code> file.
  212. <var>val</var> should be a hexadecimal prefixed by &lsquo;<samp>0x</samp>&rsquo; or decimal
  213. codepage code. The valid range is from zero up to 0xffff, but the
  214. validity of the codepage is host and configuration dependent.
  215. </p>
  216. </dd>
  217. <dt><code>-l <var>val</var></code></dt>
  218. <dt><code>--language <var>val</var></code></dt>
  219. <dd><p>Specify the default language to use when reading an <code>rc</code> file.
  220. <var>val</var> should be a hexadecimal language code. The low eight bits are
  221. the language, and the high eight bits are the sublanguage.
  222. </p>
  223. </dd>
  224. <dt><code>--use-temp-file</code></dt>
  225. <dd><p>Use a temporary file to instead of using popen to read the output of
  226. the preprocessor. Use this option if the popen implementation is buggy
  227. on the host (eg., certain non-English language versions of Windows 95 and
  228. Windows 98 are known to have buggy popen where the output will instead
  229. go the console).
  230. </p>
  231. </dd>
  232. <dt><code>--no-use-temp-file</code></dt>
  233. <dd><p>Use popen, not a temporary file, to read the output of the preprocessor.
  234. This is the default behaviour.
  235. </p>
  236. </dd>
  237. <dt><code>-h</code></dt>
  238. <dt><code>--help</code></dt>
  239. <dd><p>Prints a usage summary.
  240. </p>
  241. </dd>
  242. <dt><code>-V</code></dt>
  243. <dt><code>--version</code></dt>
  244. <dd><p>Prints the version number for <code>windres</code>.
  245. </p>
  246. </dd>
  247. <dt><code>--yydebug</code></dt>
  248. <dd><p>If <code>windres</code> is compiled with <code>YYDEBUG</code> defined as <code>1</code>,
  249. this will turn on parser debugging.
  250. </p></dd>
  251. </dl>
  252. <hr>
  253. <div class="header">
  254. <p>
  255. Next: <a href="dlltool.html#dlltool" accesskey="n" rel="next">dlltool</a>, Previous: <a href="windmc.html#windmc" accesskey="p" rel="prev">windmc</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Binutils-Index.html#Binutils-Index" title="Index" rel="index">Index</a>]</p>
  256. </div>
  257. </body>
  258. </html>