.DEF

Файл DEF

Module-Definition File
Задать вопрос
БЫСТРЫЙ ОТВЕТ

A DEF file is a plain-text linker directive file - most commonly an EXPORTS list that tells the Windows linker which functions a DLL should expose. Open it in any text editor such as VS Code or Notepad++. It is a build input passed to the linker with /DEF:name.def, not a program you run.

Разработчик: Microsoft (Windows toolchain; also used by MinGW/GCC, Watcom, Digital Mars) Категория: Файлы разработчика MIME: text/plain
ОТКРЫВАЕТСЯ НА Windows macOS Linux
Связанные: .DO · .MD · .HEX · .XSD

На этой странице

Проиндексировано расширений: 19k+
Последняя проверка: Jul 13, 2026

Не знаете, что это за файл?

Перетащите любой файл в наш идентификатор - мы прочитаем первые байты, чтобы определить формат.

Идентифицировать файл

Что такое формат файла DEF?

.def files are associated with Windows and OS/2 development environments, used alongside C, C++, and other compiled languages.

Files with the .def extension store data in plain text format. .def files are sometimes referred to as module definition files and are used for generating DLL libraries. A .def file stores a special set of linker directives - statements such as LIBRARY, EXPORTS, IMPORTS, SECTIONS, HEAPSIZE, and STACKSIZE - used to define key aspects of a DLL library, including which functions and data symbols are exposed to callers and what ordinal numbers they carry.

The file is passed to the linker at build time using the /DEF:name.def switch (MSVC) or equivalent flags in MinGW/GCC and LLVM lld-link. It is a build input, not a compiled artifact; the resulting binary is a .dll or .exe.

A DLL is a library file that stores executable code and other related data. DLL files are reusable - they can be accessed by multiple applications simultaneously - and loaded dynamically when needed. DLL files are also a means of saving disk space and operational memory due to their dynamic nature. Updating software is also easier due to the fact that DLL files are shared among multiple applications.

Modern C/C++ compilers allow developers to mark exported symbols directly in source code using __declspec(dllexport), largely reducing the need for a separate .def file. However, .def files remain supported by the current MSVC linker (link.exe) and LLVM lld-link, and are still preferred when a stable, explicitly ordered export table is required.

Безопасность и защита

РИСК: LOW

A module-definition .def is a tiny plain-text build file and is safe to open and read - it cannot execute. The only practical risk is editing it in a real project: changing or removing an EXPORTS entry alters the DLL's public interface and can break callers or change export ordinals, so understand the ABI impact before editing. As with any source file, only trust .def files from project sources you control.

Детали формата

в двух словах
ПОЛНОЕ НАЗВАНИЕModule-Definition Fileтакже известен как Module Definition File, DEF file
РАЗРАБОТЧИКMicrosoft (Windows toolchain; also used by MinGW/GCC, Watcom, Digital Mars)с Windows / OS/2 development, late 1980s-1990s (16-bit, then Win32)
MIME-ТИПtext/plain
ТИПPlain-text linker directive file (statements: LIBRARY, EXPORTS, IMPORTS...)
СВЯЗАННЫЕ.do.md.hex.xsd
Это расширение также используется в…
  • Tibia / OTClient map file (.def) - Some game tooling and the Tibia map editor used .def for map/spawn definitions - unrelated to linkers.
  • ESRI ArcView / SmartWare data definition - Older database and GIS tools (SmartWare, ArcView, DataFlex) wrote .def schema/definition files of their own.
  • AniSprite animation definition / Oberon-2 & Modula-2 DEFINITION module - AniSprite stored sprite-animation definitions in .def; Modula-2/Oberon use .def for a module's public interface.

Программы, открывающие файлы DEF

Windows4 apps
Windows Notepad Встроенная Open with > Notepad for a quick read of a small .def; lacks syntax help.
Notepad Открытый код Right-click > Edit with Notepad++ to view/edit the linker directives with line numbers.
Visual Studio Code Бесплатно Open the .def to read/edit the EXPORTS list as plain text. Best free general choice.
Visual Studio (MSVC) Freemium Add the .def to a project and pass it via Linker > Input > Module Definition File (/DEF). Visual Studio also opens it as text for editing.
macOS1 app
Visual Studio Code Бесплатно Open the .def to read/edit the EXPORTS list as plain text. Best free general choice.
Linux2 apps
nano / vim Открытый код Edit in the terminal when cross-building Windows DLLs (MinGW-w64/LLVM consume .def via -Wl,--def or /DEF).
Visual Studio Code Бесплатно Open the .def to read/edit the EXPORTS list as plain text. Best free general choice.

Технические подробности

глубокая спецификация
Format typePlain-text linker directive file
MIME typetext/plain
Character encodingASCII / ANSI; UTF-8 without BOM is typical
File signature (magic bytes)None - identified by keywords such as LIBRARY, EXPORTS, or NAME at the start of lines
Typical file sizeUnder 1 KB to a few KB (one exported symbol per line)
Core statement: LIBRARY / NAMEDeclares the module name embedded in the DLL's internal header
Core statement: EXPORTSLists each symbol to expose, with optional ordinal (@N), NONAME, and DATA flags
Additional statementsIMPORTS, SECTIONS (set section attributes), HEAPSIZE, STACKSIZE
Linker switch (MSVC)/DEF:filename.def passed to link.exe at build time
Supporting toolchainsMSVC link.exe, MinGW/GCC ld, LLVM lld-link, Watcom linker, Digital Mars linker
Output artifactsControls the export table of a .dll and the import library (.lib) generated alongside it
Associated operating systemsWindows (primary); OS/2 (legacy); 16-bit DOS (legacy)
Modern alternative__declspec(dllexport) in source code; .def still preferred for stable export ordinals and toolchain portability
Legacy 16-bit keywordsCODE and DATA segment-attribute statements present in 16-bit Windows/OS/2 DEF files; obsolete under Win32
Compression and encryptionNone - always stored as uncompressed, unencrypted plain text
ВыпущенWindows / OS/2 development, late 1980s-1990s (16-bit, then Win32)
Последняя версияSame statement syntax used by the current MSVC linker (link.exe) and LLVM lld-link
Спецификацияlearn.microsoft.com

Конвертации DEF

Вопросы и ответы сообщества

спрошено пользователями
Задать быстрый вопрос
Получите помощь от людей, работающих с файлами DEF. Будьте конкретны - укажите вашу систему и версию ПО.
Аккаунт не нужен · ответы обычно в течение дня

Вопросов пока нет - станьте первым, кто спросит о файлах DEF.

Часто задаваемые вопросы

What is a .def file in programming?
A module-definition file: a plain-text list of linker directives - chiefly an EXPORTS section naming the functions a DLL should expose. You pass it to the linker (link /DEF:name.def) when building a Windows DLL or EXE.
How do I open a .def file?
It's plain text - open it in VS Code, Notepad++, or the editor inside Visual Studio. To use it in a build, add it to your project's linker Module-Definition File setting (/DEF).
Do I still need a .def file if I use __declspec(dllexport)?
Often not - source-level export attributes cover most cases. But .def is still useful for stable export ordinals, exporting undecorated C names, or toolchains/legacy projects that expect it.
How do I create a .lib from a .def?
Use the MSVC LIB tool: lib /DEF:name.def /OUT:name.lib /MACHINE:X64 (or MinGW's dlltool). This builds an import library so other code can link against the DLL the .def describes.
Why does my linker report missing exports?
Often the symbol isn't listed in the .def's EXPORTS section, the name is decorated differently than expected, or the ordinal changed. Check the EXPORTS list matches the actual function names and is passed to the linker.
My .def file isn't a linker file - what else uses .def?
Several unrelated programs reuse .def for their own 'definition' data - game map definitions (e.g. Tibia), database/GIS schema (SmartWare, ArcView), or Modula-2/Oberon module interfaces. Those are different formats sharing the extension.

Ссылки

1Microsoft Learn - Module-Definition (.def) Fileslearn.microsoft.com
2Microsoft Learn - EXPORTS sectionlearn.microsoft.com

Узнать больше

по всей базе данных

Популярные расширения на этой неделе

1.AQQAQQ Instant Messenger File
2.CRDOWNLOADChrome Partial Download File
3.MDMarkdown Document
4.BINCD/DVD Disc Image (BIN/CUE)
5.NOMEDIAAndroid No-Media Marker File
6.PARTPartial Download File
7.RPMSGRestricted Permission Message
8.EXEWindows Executable (Portable Executable)
9.AVIFAV1 Image File Format (AVIF)
10.DBSQLite Database File

Похожие расширения

.DOStata Do-File
.MDMarkdown Document
.HEXIntel HEX File
.XSDXML Schema Definition
.MAPSource Map (JavaScript / CSS)
.CONFIGConfiguration File

Бесплатные инструменты для файлов

Идентификатор файлов и конвертер изображений в браузере - все работает на вашем устройстве.

Открыть инструменты

Обзор расширений файлов A-Z