Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can a DLL have zero exports?

Tags:

dll

dllexport

I recently ran across a DLL installed on my system that Dependancy Walker (and every other utility I tried) says has zero exports by name or ordinal, yet the file is approximately 4mb in size. I thought the sole purpose of a DLL was to export functions for use by other code so what would be the purpose of a dll with no visible exports?

like image 402
Bryan Dunphy Avatar asked Jan 30 '10 03:01

Bryan Dunphy


People also ask

What are EXPORTS in a DLL?

A DLL file has a layout very similar to an .exe file, with one important difference — a DLL file contains an exports table. The exports table contains the name of every function that the DLL exports to other executables.

What does __ Declspec Dllexport do?

__declspec(dllexport) adds the export directive to the object file so you do not need to use a . def file. This convenience is most apparent when trying to export decorated C++ function names.

What is DLL export C++?

The dllexport and dllimport storage-class attributes are Microsoft-specific extensions to the C and C++ languages. You can use them to export and import functions, data, and objects to or from a DLL.

What is ordinal in DLL?

An ordinal number an identifier for an exported function in a DLL. Each exported function in a DLL has a unique identifier assigned to it - its ordinal number. When you make calls to a Dynamic Link Library (DLL) you can access exported functions by either referencing the function name or ordinal number.


2 Answers

One way to think of a DLL is as a container for functions. Exporting a function from a DLL makes those functions visible to callers outside of the DLL. While exporting functions from a DLL is perhaps the most common way to provide access to them, many platforms provide other ways to access functions which have not been exported such as reflection in the .NET Framework and Java and (I think) LoadLibtary / GetProcAddress in Win32

Reasons for doing this are varied, often it is because it is beneficial to the developer to have functions in a library but undesirable for those functions to be called from external applications

like image 140
Crippledsmurf Avatar answered Sep 21 '22 03:09

Crippledsmurf


Resource-only DLL, maybe? Those are used quite often for localization purposes, for example.

EDIT: it's also possible to have a DLL with code that does something in DllMain() to somehow make its functionality available. The DLL can register itself with some global dispatcher, for example, or create named kernel objects...

like image 34
Seva Alekseyev Avatar answered Sep 24 '22 03:09

Seva Alekseyev