def-file-format.html 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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-2017 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 5.2, http://www.gnu.org/software/texinfo/ -->
  12. <head>
  13. <title>GNU Binary Utilities: def file format</title>
  14. <meta name="description" content="GNU Binary Utilities: def file format">
  15. <meta name="keywords" content="GNU Binary Utilities: def file format">
  16. <meta name="resource-type" content="document">
  17. <meta name="distribution" content="global">
  18. <meta name="Generator" content="makeinfo">
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  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="dlltool.html#dlltool" rel="up" title="dlltool">
  24. <link href="readelf.html#readelf" rel="next" title="readelf">
  25. <link href="dlltool.html#dlltool" rel="prev" title="dlltool">
  26. <style type="text/css">
  27. <!--
  28. a.summary-letter {text-decoration: none}
  29. blockquote.smallquotation {font-size: smaller}
  30. div.display {margin-left: 3.2em}
  31. div.example {margin-left: 3.2em}
  32. div.indentedblock {margin-left: 3.2em}
  33. div.lisp {margin-left: 3.2em}
  34. div.smalldisplay {margin-left: 3.2em}
  35. div.smallexample {margin-left: 3.2em}
  36. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  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.nocodebreak {white-space:nowrap}
  48. span.nolinebreak {white-space:nowrap}
  49. span.roman {font-family:serif; font-weight:normal}
  50. span.sansserif {font-family:sans-serif; font-weight:normal}
  51. ul.no-bullet {list-style: none}
  52. -->
  53. </style>
  54. </head>
  55. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  56. <a name="def-file-format"></a>
  57. <div class="header">
  58. <p>
  59. Up: <a href="dlltool.html#dlltool" accesskey="u" rel="up">dlltool</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>
  60. </div>
  61. <hr>
  62. <a name="The-format-of-the-dlltool-_002edef-file"></a>
  63. <h3 class="section">14.1 The format of the <code>dlltool</code> <samp>.def</samp> file</h3>
  64. <p>A <samp>.def</samp> file contains any number of the following commands:
  65. </p>
  66. <dl compact="compact">
  67. <dt><code>NAME</code> <var>name</var> <code>[ ,</code> <var>base</var> <code>]</code></dt>
  68. <dd><p>The result is going to be named <var>name</var><code>.exe</code>.
  69. </p>
  70. </dd>
  71. <dt><code>LIBRARY</code> <var>name</var> <code>[ ,</code> <var>base</var> <code>]</code></dt>
  72. <dd><p>The result is going to be named <var>name</var><code>.dll</code>.
  73. Note: If you want to use LIBRARY as name then you need to quote. Otherwise
  74. this will fail due a necessary hack for libtool (see PR binutils/13710 for more
  75. details).
  76. </p>
  77. </dd>
  78. <dt><code>EXPORTS ( ( (</code> <var>name1</var> <code>[ = </code> <var>name2</var> <code>] ) | ( </code> <var>name1</var> <code>=</code> <var>module-name</var> <code>.</code> <var>external-name</var> <code>) ) [ == </code> <var>its_name</var> <code>]</code></dt>
  79. <dt><code>[</code> <var>integer</var> <code>] [ NONAME ] [ CONSTANT ] [ DATA ] [ PRIVATE ] ) *</code></dt>
  80. <dd><p>Declares <var>name1</var> as an exported symbol from the DLL, with optional
  81. ordinal number <var>integer</var>, or declares <var>name1</var> as an alias
  82. (forward) of the function <var>external-name</var> in the DLL.
  83. If <var>its_name</var> is specified, this name is used as string in export table.
  84. <var>module-name</var>.
  85. Note: The <code>EXPORTS</code> has to be the last command in .def file, as keywords
  86. are treated - beside <code>LIBRARY</code> - as simple name-identifiers.
  87. If you want to use LIBRARY as name then you need to quote it.
  88. </p>
  89. </dd>
  90. <dt><code>IMPORTS ( (</code> <var>internal-name</var> <code>=</code> <var>module-name</var> <code>.</code> <var>integer</var> <code>) | [</code> <var>internal-name</var> <code>= ]</code> <var>module-name</var> <code>.</code> <var>external-name</var> <code>) [ == ) <var>its_name</var> <code>]</code> *</code></dt>
  91. <dd><p>Declares that <var>external-name</var> or the exported function whose
  92. ordinal number is <var>integer</var> is to be imported from the file
  93. <var>module-name</var>. If <var>internal-name</var> is specified then this is
  94. the name that the imported function will be referred to in the body of
  95. the DLL.
  96. If <var>its_name</var> is specified, this name is used as string in import table.
  97. Note: The <code>IMPORTS</code> has to be the last command in .def file, as keywords
  98. are treated - beside <code>LIBRARY</code> - as simple name-identifiers.
  99. If you want to use LIBRARY as name then you need to quote it.
  100. </p>
  101. </dd>
  102. <dt><code>DESCRIPTION</code> <var>string</var></dt>
  103. <dd><p>Puts <var>string</var> into the output <samp>.exp</samp> file in the
  104. <code>.rdata</code> section.
  105. </p>
  106. </dd>
  107. <dt><code>STACKSIZE</code> <var>number-reserve</var> <code>[, </code> <var>number-commit</var> <code>]</code></dt>
  108. <dt><code>HEAPSIZE</code> <var>number-reserve</var> <code>[, </code> <var>number-commit</var> <code>]</code></dt>
  109. <dd><p>Generates <code>--stack</code> or <code>--heap</code>
  110. <var>number-reserve</var>,<var>number-commit</var> in the output <code>.drectve</code>
  111. section. The linker will see this and act upon it.
  112. </p>
  113. </dd>
  114. <dt><code>CODE</code> <var>attr</var> <code>+</code></dt>
  115. <dt><code>DATA</code> <var>attr</var> <code>+</code></dt>
  116. <dt><code>SECTIONS (</code> <var>section-name</var> <var>attr</var><code> + ) *</code></dt>
  117. <dd><p>Generates <code>--attr</code> <var>section-name</var> <var>attr</var> in the output
  118. <code>.drectve</code> section, where <var>attr</var> is one of <code>READ</code>,
  119. <code>WRITE</code>, <code>EXECUTE</code> or <code>SHARED</code>. The linker will see
  120. this and act upon it.
  121. </p>
  122. </dd>
  123. </dl>
  124. <hr>
  125. <div class="header">
  126. <p>
  127. Up: <a href="dlltool.html#dlltool" accesskey="u" rel="up">dlltool</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>
  128. </div>
  129. </body>
  130. </html>