DLL Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The DLL class enables communication with a Microsoft Windows dynamic-link library (DLL).
public ref class DLL : Microsoft::Dynamics::Ax::Xpp::XppObjectBase
[Microsoft.Dynamics.Ax.Xpp.KernelClass]
[Microsoft.Dynamics.BusinessPlatform.SharedTypes.InternalUseOnly]
public class DLL : Microsoft.Dynamics.Ax.Xpp.XppObjectBase
[<Microsoft.Dynamics.Ax.Xpp.KernelClass>]
[<Microsoft.Dynamics.BusinessPlatform.SharedTypes.InternalUseOnly>]
type DLL = class
inherit XppObjectBase
Public Class DLL
Inherits XppObjectBase
- Inheritance
- Attributes
-
KernelClassAttribute Microsoft.Dynamics.BusinessPlatform.SharedTypes.InternalUseOnlyAttribute
Remarks
If you are using a Unicode DLL, do the following:
- Use ExtTypes::WString instead of ExtTypes::String to specify a string type.
- Use Binary::WString instead of Binary::String if you have character data embedded in a binary structure.
- Use the Binary.wstring method instead of the Binary.string method if you have to read a string from a binary object.
The following example uses the DLL and DLLFunction classes to interoperate with the GetVersion API in Kernel32.dll. This example asserts the use of the InteropPermission class, which is required only if the code is running on the server. It loads the DLL and, if it is successful, sets the return type from the call to the DLLFunction class.
void DLLExample()
{
Dll dll;
DllFunction dllFunc;
anytype retVal;
InteropPermission perm;
perm = new InteropPermission(InteropKind::DllInterop);
// Grants permission to execute the DLL.new method.
// DLL.new runs under code access security.
perm.assert();
dll = new Dll("Kernel32.dll");
// Closes the code access permission scope.
CodeAccessPermission::revertAssert();
if (dll != null)
{
perm = new InteropPermission(InteropKind::DllInterop);
// Grants permission to execute the DLLFunction.new method.
// DLLFunction.new runs under code access security.
perm.assert();
dllFunc = new DllFunction(dll, "GetVersion");
if (dllFunc != null)
{
dllFunc.returns(ExtTypes::DWord);
retVal = dllFunc.call();
}
// Closes the code access permission scope.
CodeAccessPermission::revertAssert();
}
}
Constructors
DLL() | |
DLL(IntPtr) | |
DLL(String) |
Fields
__k_DLLId | |
kernelClass | (Inherited from XppObjectBase) |