|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Calling a DLL Function
Updated: February 2010
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 describes 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 structures 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.