Share via


DLL Class

The DLL class provides the ability to communicate with a Microsoft Windows dynamic-link library (DLL).

Syntax

class DLL extends Object

Run On

Called

Methods

  Method Description
Gg804382.pubmethod(en-us,AX.60).gif cancelTimeOut Cancels a previous method call to the setTimeOut method. (Inherited from Object.)
Gg804382.pubmethod(en-us,AX.60).gif equal Determines whether the specified object is equal to the current one. (Inherited from Object.)
Gg804382.pubmethod(en-us,AX.60).gif finalize Releases resources and performs clean-up before an instance of the DLL class is released.
Gg804382.pubmethod(en-us,AX.60).gif getTimeOutTimerHandle Returns the timer handle for the object. (Inherited from Object.)
Gg804382.pubmethod(en-us,AX.60).gif handle Retrieves the handle of the class of the object. (Inherited from Object.)
Gg804382.pubmethod(en-us,AX.60).gif new Creates an instance of the class. (Overrides the new Method.)
Gg804382.pubmethod(en-us,AX.60).gif notify Releases the hold on an object that has called the wait method on this object. (Inherited from Object.)
Gg804382.pubmethod(en-us,AX.60).gif notifyAll Releases a lock on the object that was issued by the wait method on this object. (Inherited from Object.)
Gg804382.pubmethod(en-us,AX.60).gif objectOnServer Determines whether the object is on a server. (Inherited from Object.)
Gg804382.pubmethod(en-us,AX.60).gif owner Returns the instance that owns the object. (Inherited from Object.)
Gg804382.pubmethod(en-us,AX.60).gif setTimeOut Sets up the scheduled execution of a specified method. (Inherited from Object.)
Gg804382.pubmethod(en-us,AX.60).gif toString Returns a string that represents the current object. (Inherited from Object.)
Gg804382.pubmethod(en-us,AX.60).gif usageCount Returns the current number of references, that is, the value of the reference counter, that the object has. (Inherited from Object.)
Gg804382.pubmethod(en-us,AX.60).gif wait Pauses a process. (Inherited from Object.)
Gg804382.pubmethod(en-us,AX.60).gif xml Returns an XML string that represents the current object. (Inherited from Object.)
Gg804382.pubmethod(en-us,AX.60).gif Gg804382.static(en-us,AX.60).gif ::lastDLLError Sets or retrieves the last error that was reported by the DLL.

Top

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 need to read a string from a binary object.

ExtTypes::WString Example (Code Example Removed) Binary.wString Example (Code Example Removed)

Examples

The following example uses the DLL and the DLLFunction classes to interoperate with the GetVersion API in Kernel32.dll. The example asserts the use of the InteropPermission class, which is only needed if the code is running on the server. It loads the DLL, and, if it is successful, it 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(); 
    } 
}

Inheritance Hierarchy

Object Class
  DLL Class

See Also

DLLFunction Class