LoadWithDotNetCore
PowerScript function
Description
Loads a .NET Core assembly.
Note
In PowerBuilder 2022 R2 and later, you should upgrade your .NET
Core assembly to .NET 6.0 assembly and use the LoadWithDotNet function
instead.
PowerBuilder 2022 R2 and later supports .NET only (.NET
Framework and .NET Core have
been removed since Version 2022 R2).
Applies to
Syntax
|
1 |
objectname.LoadWithDotNetCore ( readonly string assemblypath {, string dotnetcoreversion }) |
|
Argument |
Description |
|---|---|
|
objectname |
The name of the DotNetAssembly object. |
|
assemblypath |
The name and location of the .NET assembly (*.dll). The location can be an absolute path or a relative path. |
|
dotnetcoreversion (optional) |
The highest .NET Core version to be supported. 2.1 and |
Return value
Integer.
Returns values as follows. If any argument’s value is null, the
method returns null.
1 — Success.
-1 — Unknown error.
-2 — Could not find the assembly.
-3 — It’s not a valid assembly.
-4 — The assembly requires a dependent assembly.
-19 — Cannot find the .NET Core runtime.
-20 — Failed to load the .NET Core virtual machine.
Usage
If an application uses LoadWithDotNetCore and LoadWithDotNet at the
same time, the .NET Runtime cannot be the same version, otherwise the
subsequent execution will fail to load. You need to specify different
versions of the .NET Runtime. For the LoadWithDotNetCore function, the
version can be specified by using the dotnetcoreversion argument.
Examples
The following example loads a DLL with .NET Core 2.1.6:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
Long ll_return String ls_dll DotNetAssembly lcs_ass //Specifies a DLL in the relative path ls_dll = "Appeon.Simple.dll" //Instantiates the DotNetAssembly object lcs_ass = create DotNetAssembly //Loads the DLL with .NET Core 2.1.6 ll_return = lcs_ass.LoadWithDotNetCore(ls_dll,"2.1.6") //Loads the DLL with the most curret .NET Core version on this machine //ll_return = lcs_ass.LoadWithDotNetCore(ls_dll) //Checks the result If ll_return < 0 then Messagebox("Load "+ls_dll+" Failed", lcs_ass.ErrorText) Return ll_return End if |
See also