DllImportAttribute Constructor (String^)
Initializes a new instance of the DllImportAttribute class with the name of the DLL containing the method to import.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- dllName
-
Type:
System::String^
The name of the DLL that contains the unmanaged method. This can include an assembly display name, if the DLL is included in an assembly.
If an unmanaged DLL file is included in an assembly, for example, by using the linker or the /linkresource compiler option, you can specify the assembly display name as part of dllName. For example, if an unmanaged DLL named unmanaged.dll is included in a managed assembly named MyAssembly, the attribute might be specified as shown in the following code.
The following code example shows how to use the DllImportAttribute attribute to import the Win32 MessageBox function. The code example then calls the imported method.
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1