PALATINELABSDocsENES

Pages

↑↓ to moveEnter to openEsc to close

DLL package guide

Load a .NET DLL and call a public static method by name.

Version 2.17.1. Installed versions can differ. Examples are illustrative and not tested.

Jump to actions

Packages

Prerequisites

Use a .NET DLL, not a native C or C++ DLL. Load trusted code only: it runs with the automation's permissions. Put private DLL dependencies beside it; the runtime must have the others.

Use Open, Run function, then Close in cleanup. A relative path starts in the Run folder. The main file is read into memory, so you can replace it while open.

For the example, build samples/ExampleTools.dll with public class ExampleTools.Calculator and public static int Add(int a, int b) => a + b;. Avoid methods with the same name and parameter count. The first found is called, without a type check.

Shared fields

Session

Field IDName in editorType; defaultUse
sessionSession nameStringdefault DefaultoptionalThe name that joins Open, Run function and Close, for example Tools⁠. A session does not carry over to another Run.

Actions

Close (dllClose)

Close the DLL session.

Inputs

Uses the session field.

Outputs

No outputs.

Example

After Open and Run function with session=Tools, set session=Tools in Close.

Expected result

The session closes. The DLL unloads when no code uses it. Run function with Tools fails until reopened. Closing a session that is not open fails.

Back to actions

Open (dllOpen)

Load a .NET DLL. Give each open DLL its own session name.

Inputs

Uses the session field.

Field IDName in editorType; default; requirementUse
dllFilePathDLL file pathStringdefault emptyrequiredAn existing .NET DLL, such as samples/ExampleTools.dll⁠. A relative path starts in the Run folder.

Outputs

OutputTypeMeaning
sessionNameStringThe session name. Bind it to toolsSession to use $toolsSession$ in later session fields.

Example

Build the example DLL. Set session=Tools and dllFilePath=samples/ExampleTools.dll. Bind sessionName to String variable toolsSession. Close Tools before opening another DLL with that name.

Expected result

toolsSession is Tools, and Run function can use the DLL. An empty or missing file, a file that is not a .NET DLL, or a missing dependency fails. Open does not check the methods in advance.

Back to actions

Run function (dllRunFunction)

Call a public static method and get its result as text.

Inputs

Uses the session field.

Field IDName in editorType; default; requirementUse
classNameClass nameStringdefault emptyrequiredThe full class name, such as ExampleTools.Calculator⁠. Case does not matter. The namespace is needed.
functionNameFunction nameStringdefault emptyrequiredThe exact public static method name, such as Add⁠. Case matters.
inputParametersParametersListdefault emptyoptionalText values, one per parameter, in order, such as ["2","40"]⁠. The count must match. Only simple types work (text, numbers, true/false⁠, enum names in any case). Use . as the decimal point. Empty text becomes null only for a nullable parameter. The action does not build objects or arrays, and it does not wait for an async method.

Outputs

OutputTypeMeaning
resultStringThe return value as text. Bind to sumText⁠. Convert number text before a Number field.

Example

Open the example DLL as Tools. Set session=Tools, className=ExampleTools.Calculator, functionName=Add, and inputParameters=["2","40"]. Bind result to String variable sumText.

Expected result

sumText is the text 42. A Boolean result becomes true or false, a number uses . as the decimal point, and a void or null result becomes empty text. A missing session, class or method, a wrong parameter count, a value that does not convert, or an error in the method fails the step.

Back to actions