Reputation: 63676
LIBRARY Vcam.ax
EXPORTS
DllMain PRIVATE
DllGetClassObject PRIVATE
DllCanUnloadNow PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
The above is from Filters.def
, what does it actually do?
Upvotes: 3
Views: 16651
Reputation: 137870
See MSDN:
Module-Definition (.def) Files
Exporting from a DLL Using DEF Files
About PRIVATE
, they say this:
The optional keyword PRIVATE prevents entryname from being placed in the import library generated by LINK. It has no effect on the export in the image also generated by LINK.
In other words, those functions are hidden from the DLL's table of entry points and reserved for the OS.
Upvotes: 5
Reputation: 6758
The .def file on Win32 describes what functions get exported from a DLL. Unlike with .so files on gcc/Linux, where every symbol gets exported by default, you have to tell the compiler what functions to export. The standard way is to list it in a .def file. The other way is to use __declspec(dllexport) with Visual C++ (where using decorated function names would be no fun to use).
There are some keywords to place after the function name; you can speficy an ordinal number, that it shouldn't be exported by name (good for hiding your function names), or that it is private.
The documentation on MSDN describes the complete format:
Module-Definition (.def) Files
Upvotes: 4
Reputation: 942010
A .def file declares the names of the functions that are exported from the DLL. So that code in other modules can call these functions. This is distinct from a header file declaration.
It's a bit outdated, .def files were required back in the Windows 3 days. The better mouse trap is to declare the function with __declspec(dllexport), an attribute that the linker uses to do it automatically without a .def file. In this specific case though the .def file is still necessary because the name decoration for the exported function will be wrong (_DllRegisterServer@0 for example).
The 4 functions you see listed here are the 4 exports that any in-process COM server requires. Looks like a DirectShow filter, they are implemented as a COM server. Exporting DllMain is a mistake.
Upvotes: 0