Bagikan melalui


Calling a DLL Function

Although calling unmanaged DLL functions is nearly identical to calling other managed code, there are differences that can make DLL functions seem confusing at first. This section introduces topics that describe some of the unusual calling-related issues.

Structures that are returned from platform invoke calls must be data types that have the same representation in managed and unmanaged code. Such types are called blittable types because they do not require conversion (see Blittable and Non-Blittable Types). To call a function that has a non-blittable structure as its return type, you can define a blittable helper type of the same size as the non-blittable type and convert the data after the function returns.

In This Section