Jaa


DLL Class

Definition

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
Microsoft.Dynamics.AX.KernelInterop.ProxyBase
DLL
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)

Methods

__shouldCallNew(Type)
addXppProxyReference(Type, Object) (Inherited from XppObjectBase)
Call(String, Object[], Type[], Object[]) (Inherited from XppObjectBase)
cancelTimeOut(Int32) (Inherited from XppObjectBase)
createKernelClass(Object[], Type[], Object[]) (Inherited from XppObjectBase)
equal(XppObjectBase) (Inherited from XppObjectBase)
finalize()

Releases resources and performs clean-up before an instance of the DLL class is released.

GetIntPtr() (Inherited from XppObjectBase)
GetKernelInstanceUniqueId() (Inherited from XppObjectBase)
getTimeOutTimerHandle() (Inherited from XppObjectBase)
getXppProxyReference(Type) (Inherited from XppObjectBase)
handle()
IsManagedValid() (Inherited from XppObjectBase)
kernelhandle()
KernelInstanceDisposed() (Inherited from XppObjectBase)
lastDLLError()

Sets or retrieves the last error that was reported by the DLL.

MakeReflectionCall(String, Object[]) (Inherited from XppObjectBase)
newmethod() (Inherited from XppObjectBase)
newmethod(String)

Creates an instance of the DLL class.

notify() (Inherited from XppObjectBase)
notifyAll() (Inherited from XppObjectBase)
objectOnServer()
Obsolete.
(Inherited from XppObjectBase)
setTimeOut(String, Int32, Boolean)
Obsolete.
(Inherited from XppObjectBase)
setTimeOut(String, Int32)
Obsolete.
(Inherited from XppObjectBase)
usageCount() (Inherited from XppObjectBase)
VerifyKernelClass() (Inherited from XppObjectBase)
wait() (Inherited from XppObjectBase)
Xml() (Inherited from XppObjectBase)
Xml(Int32) (Inherited from XppObjectBase)

Applies to