What is the function of a DLL

Calling a DLL function

Although calls to unmanaged DLL functions are almost identical to other calls to managed code, there are differences that make DLL functions confusing at first. This section contains topics that describe some unusual calling-related problems.

Structures returned by platform invoke calls must be data types that have the same representation in managed and unmanaged code. Such types will be blitable types because no conversion is required (see Blitable and Non-Blitable Types). To call a function that has a non-blitable structure as a return type, you can define an auxiliary blitable type the same size as the non-blitable type and convert data after the function returns.

In this section

Passing structures
Identifies the problems of transferring data structures with a predefined layout.

Callback functions
Provides basic information about callback functions.

How to: Implement Callback Functions
Describes how to implement callback functions in managed code.

Related sections

Use unmanaged DLL functions
Describes how to call unmanaged DLL functions using platform calls

Marshalling data with platform invocation
Describes how to declare method parameters and pass arguments to functions exported from unmanaged libraries.