DLL package

A dynamic-link library (DLL) file contains a shared library of functions that can be used by Windows programs. The DLL package uses a .dll file as reference and calls functions from the bot.

Before you start

Perform the following actions within the DLL package as part of using the set of available actions:
Note:
  • If you create bots using custom DLL, and the custom DLL has a dependency on the Apache log4net library, then we recommend using:
    • log4net version 2.0.11 or later in the custom DLL.
    • Update the Bot Agent (version 21.210 or later) even if the Bot Agent update is optional.
  • Only the DLLs built using the Microsoft .NET Framework are supported.
  • The Run DLL package is compatible with the following versions of Microsoft .NET: 4.6, 4.7, and 4.8.
  • When you create a bot and use the local session with loop, ensure that you use the close session action in the bot. If you do not use the close session command, then the local session will open AutomationAnywhere.ManagedDLLWrapper.exe with each iteration of the loop. As a result, you will run out of memory space and the bot will fail.
Important: If you use different versions of the DLL package in a parent bot and a child bot, the capability to share a session across bots is currently not supported. To share a session across parent and child bots, ensure that you use the same version of the package in both the parent and child bots.
  1. Use the Open action to specify the location of the .dll file you want to use and session name. Use this same session name for the other actions. The .dll referenced is automatically added as a bot dependency.
  2. Use the Run function action to run a function from the .dll and save its output value as a variable.
  3. After running the required functions, close the .dll reference. It is important to close the .dll reference to free the memory of the operating system.

    Windows and appropriate versions of Microsoft .NET Framework are available on the devices running the DLLs.

    To review the bot launcher logs, navigate to C:\ProgramData\AutomationAnywhere\BotRunner\Logs\<current month>\Bot_Launcher-<today's date>.log.zip. Each zipped folder contains a file with data on the code execution, which is useful for debugging.

Note: If the .dll file uses .NET functions or classes from another .dll file, you must add the second .dll file as a manual dependency of the bot.

Bot dependencies

When you import multiple DLLs that have one main DLL and other DLLs are referenced from it, ensure you have all the DLLs in one folder. Also, the referenced DLLs must be called using a session name that is different from the name used in the main DLL. Your bot execution will fail if the same session name is used in both the main and the referenced DLLs.

Actions in the DLL package

The DLL package includes the following actions:

Action Description
Close

See Close action

Open

See Open action

Run function See Using the Run function action.

Supported data types in DLL functions

The following table list the variables and data types that you can use as an input or output parameter in DLL functions.
Note: The Run function action does not support any user-defined data types in the Parameter to the function or Assign output to variable field.
Variable type as input or output parameters Supported data types in .NET
String
  • Char
  • Byte
  • String
  • string
  • SByte
Number
  • UInt16
  • Int16
  • UInt32
  • Int32
  • UInt64
  • Int64
  • Int
  • Single
  • Decimal
  • Float
  • Double
Boolean
  • Boolean
  • bool
Datetime
  • Datetime
List
  • UInt16[]
  • Int16[]
  • Int32[]
  • Int64[]
  • Int[]
  • Char[]
  • Single[]
  • Decimal[]
  • Float[]
  • Double[]
  • Boolean[]
  • bool[]
  • Byte[]
  • String[]
  • Datetime[]
  • List<UInt16>
  • List<Int16>
  • List<Int32>
  • List<Int64>
  • List<Int>
  • List<Char>
  • List<Single>
  • List<Decimal>
  • List<Float>
  • List<Double>
  • List<Boolean>
  • List<bool>
  • List<Byte>
  • List<String>
  • List<Datetime>
  • List<SByte>
  • List<UInt32>
  • List<UInt64>
Note: The C# IList data type is not supported and does not work with the Automation 360 List data type.
Table
  • UInt16[,]
  • Int16[,]
  • Int32[,]
  • Int64[,]
  • Int[,]
  • Char[,]
  • Single[,]
  • Decimal[,]
  • Float[,]
  • Double[,]
  • Boolean[,]
  • bool[,]
  • Byte[,]
  • String[,]
  • Datetime[,]
  • Byte[,]
  • UInt32[,]
  • UInt64[,]
Note: The Table type variable is equivalent to a two-dimensional array type variable in .NET.
Dictionary
  • Dictionary<String,UInt16>
  • Dictionary<String,Int16>
  • Dictionary<String,Int32>
  • Dictionary<String,Int64>
  • Dictionary<String,Int>
  • Dictionary<String,Char>
  • Dictionary<String,Single>
  • Dictionary<String,Decimal>
  • Dictionary<String,Float>
  • Dictionary<String,Double>
  • Dictionary<String,Boolean>
  • Dictionary<String,bool>
  • Dictionary<String,Byte>
  • Dictionary<String,String>
  • Dictionary<String,Datetime>
  • Dictionary<Int,String>
  • Dictionary<Decimal,String>
  • Dictionary<Boolean,String>
  • Dictionary<String,SByte>
  • Dictionary<String,UInt32>
  • Dictionary<String,UInt64>
Note: When creating the .Net DLL function, use the IDictionary data type instead of the Dictionary data type.