AFAIK.dll
はPE形式ですが、どう.lib
ですか?
5 に答える
私はいつもCOFF形式だと思っていました
詳細については、こちらを参照してください: http://support.microsoft.com/?id=121460 (アーカイブ)
共通オブジェクト ファイル形式 (COFF)
アーティクル ID: Q121460
作成日: 05-OCT-1994
改訂日: 12-OCT-1994
この記事の情報は、次のものに適用されます。
- Microsoft Windows NT オペレーティング システム バージョン 3.1
- Microsoft Windows NT Advanced Server バージョン 3.1
- Microsoft Windows NT ワークステーション バージョン 3.5
- Microsoft Windows NT Server バージョン 3.5
まとめ
Windows NT は、実行可能 (イメージ) ファイルとオブジェクト ファイルに特別な形式を使用します。これらのファイルで使用される形式は、Portable Executable (PE) または Common Object File Format (COFF) ファイルと呼ばれます。Portable Executable という名前は、実行可能ファイルが複数のプラットフォームで実行できることを示しています。この記事では、PE/COFF ファイル形式とそのパラメーターの内部機能について詳しく説明します。
詳しくは
PE/COFF ファイル ヘッダーは、MS-DOS スタブ、ファイル署名、COFF ヘッダー、およびオプション ヘッダーで構成されます。オブジェクト ファイルには COFF ヘッダーのみが含まれますが、イメージ ファイルには上記のすべてのヘッダーが含まれます。これらのヘッダーの中で最も重要なのは COFF ヘッダーです。次の表に、COFF ヘッダーに格納される情報を示します。
Offset Size Field Description
0 2 Machine Number identifying type of target machine.
2 2 Number of Sections Number of sections; indicates size of the
Section Table, which immediately follows
the headers.
4 4 Time/Date Stamp Time and date the file was created.
8 4 Pointer to Symbol Offset, within the COFF file, of the symbol
Table table.
12 4 Number of Symbols Number of entries in the symbol table.
This data can be used in locating the
string table, which immediately follows
the symbol table.
16 2 Optional Header Size of the optional header, which is
Size included for executable files but not
object files. An object file should have a
value of 0 here.
18 2 Characteristics Flags indicating attributes of the file.
Windows NT ソフトウェア開発キット (SDK) には、DUMPBIN というユーティリティが用意されています。DUMPBIN は、32 ビット Common Object File Format (COFF) バイナリ ファイルに関する情報を表示する 32 ビット ツールです。DUMPBIN は、コマンド プロンプトからのみ実行されます。DUMPBIN を使用して、オブジェクト ファイル、COFF オブジェクトの標準ライブラリ、実行可能ファイル、およびダイナミック リンク ライブラリ (DLL) ファイルの種類の COFF ファイルを調べることができます。
DUMPBIN を実行するには、次の構文を使用します。
DUMPBIN [options] [files]
DUMPBIN のオプション パラメータと定義は次のとおりです。
/ALL
/ARCHIVEMEMBERS
/DISASM
/EXPORTS
/HEADERS
/IMPORTS
/LINENUMBERS
/LINKERMEMBER[:{1|2}]
/OUT:filename
/PDATA
/RAWDATA[:{NONE|BYTES|SHORTS|LONGS}[,#]]
/RELOCATIONS
/SECTION:name
/SUMMARY
/SYMBOLS
Options Definition
/ALL Setting this option causes DUMPBIN to display all
available information except code disassembly.
/ARCHIVEMEMBERS Setting this option causes DUMPBIN to display minimal
information about member objects in a library.
/DISASM Setting this option causes DUMPBIN to show disassembly
of code sections, using symbols if present in the file.
/EXPORTS This option causes DUMPBIN to list all definitions
exported from an executable file or DLL.
/HEADERS Setting this option causes DUMPBIN to display the file
header and the header for each section. When used with a
library, displays the header for each member object.
/IMPORTS This option causes DUMPBIN to list all definitions
imported to an executable file or DLL.
/LINENUMBERS Setting this option causes DUMPBIN to show COFF line
numbers. Line numbers exist in an object file if it was
compiled with /Zi. An executable file or DLL contains
COFF line numbers if it was linked with /DEBUG and
/DEBUGTYPE:COFF option.
/LINKERMEMBER [[:{1|2}]]
Setting this option causes DUMPBIN to list public symbols
defined in a library. Specify the 1 argument to display
symbols in object order, along with their offsets. Specify
the 2 argument to display offsets and index numbers of
objects, then list the symbols in alphabetical order along
with the object index for each. To get both outputs,
specify /LINKERMEMBER without the number argument.
/OUT:<filename> This option specifies a filename for the output.
/RAWDATA [[:{BYTES|SHORTS|LONGS|NONE}[[,number]]]]
Setting this option causes DUMPBIN to display the raw
contents of each section in the file. The arguments
control the format of the display, as follows:
Argument - Result
BYTES - The default. Contents are displayed in hexadecimal bytes,
and also as ASCII if they have a printed representation.
SHORTS - Contents are displayed in hexadecimal words.
LONGS - Contents are displayed in hexadecimal longwords.
NONE - Raw data is suppressed. This is useful to control the
output of /ALL.
number - Displayed lines are set to a width that holds number
values per line.
/RELOCATIONS Setting this option causes DUMPBIN to display any
relocations in the object or image.
/SECTION: <section>
This option restricts the output to information on the
specified section.
/SUMMARY Setting this option causes DUMPBIN to display minimal
information about sections, including total size. This
option is the default if no other option is specified
in a DUMPBIN command.
/SYMBOLS Setting this option causes DUMPBIN to display the COFF symbol
table. Symbol tables exist in all object files. A COFF symbol
table appears in an image file only if it is linked with
/DEBUG /DEBUGTYPE:COFF
一部のコンパイラ (Microsoft など) はCOFF 形式を使用し、一部 (Borland/Codegear など) はOMF 形式を使用します。
Microsoft の Lib ファイル(同じ内容、作業リンク) 形式の説明を次に示します。
16進エディター(Visual Studio 2010)でlibファイルを調べると、データはUNIX上の.aファイル...arアーカイブと同じように見えます。最初に、ある種のシンボルリストである2つの特別なファイル(空の名前)があります。
編集:重複する質問が見つかりました静的ライブラリ(* .lib)ファイルはどの形式を使用しますか?* .LIBファイルの構造/形式の「公式」仕様はどこにありますか?-これを確認するリンクがあります。