msl.examples.loadlib.dotnet64 module

Communicates with a 32-bit .NET library via the DotNet32 class.

Example of a module that can be executed within a 64-bit Python interpreter which can communicate with a 32-bit .NET library, dotnet_lib32.dll that is hosted by a 32-bit Python server, dotnet32. A 64-bit process cannot load a 32-bit library and therefore inter-process communication is used to interact with a 32-bit library from a 64-bit process.

DotNet64 is the 64-bit client and DotNet32 is the 32-bit server for inter-process communication.

class msl.examples.loadlib.dotnet64.DotNet64

Bases: Client64

Communicates with the 32-bit C# dotnet_lib32.dll library.

This class demonstrates how to communicate with a 32-bit .NET library if an instance of this class is created within a 64-bit Python interpreter.

get_class_names()

Returns the class names in the library.

See the corresponding 32-bit get_class_names() method.

Returns:

The names of the classes that are available in dotnet_lib32.dll.

Return type:

list[str]

add_integers(a, b)

Add two integers.

See the corresponding 32-bit add_integers() method.

Parameters:
  • a (int) – First integer.

  • b (int) – Second integer.

Returns:

The sum of a and b.

Return type:

int

divide_floats(a, b)

Divide two C# floating-point numbers.

See the corresponding 32-bit divide_floats() method.

Parameters:
  • a (float) – First floating-point number.

  • b (float) – Second floating-point number.

Returns:

The quotient of a / b.

Return type:

float

multiply_doubles(a, b)

Multiply two C# double-precision numbers.

See the corresponding 32-bit multiply_doubles() method.

Parameters:
  • a (float) – First double-precision number.

  • b (float) – Second double-precision number.

Returns:

The product of a * b.

Return type:

float

add_or_subtract(a, b, do_addition)

Add or subtract two C# double-precision numbers.

See the corresponding 32-bit add_or_subtract() method.

Parameters:
  • a (float) – First double-precision number.

  • b (float) – Second double-precision number.

  • do_addition (bool) – Whether to add or subtract the numbers.

Returns:

a+b if do_addition is True else a-b.

Return type:

float

scalar_multiply(a, xin)

Multiply each element in an array by a number.

See the corresponding 32-bit scalar_multiply() method.

Parameters:
Returns:

A new array with each element in xin multiplied by a.

Return type:

list[float]

multiply_matrices(a1, a2)

Multiply two matrices.

See the corresponding 32-bit multiply_matrices() method.

Parameters:
Returns:

The result of a1 * a2.

Return type:

list[list[float]]

reverse_string(original)

Reverse a string.

See the corresponding 32-bit reverse_string() method.

Parameters:

original (str) – The original string.

Returns:

The string reversed.

Return type:

str

add_multiple(a, b, c, d, e)

Add multiple integers. Calls a static method in a static class.

See the corresponding 32-bit add_multiple() method.

Parameters:
  • a (int) – First integer.

  • b (int) – Second integer.

  • c (int) – Third integer.

  • d (int) – Fourth integer.

  • e (int) – Fifth integer.

Returns:

The sum of the input arguments.

Return type:

int

concatenate(a, b, c, d, e)

Concatenate strings. Calls a static method in a static class.

See the corresponding 32-bit concatenate() method.

Parameters:
  • a (str) – First string.

  • b (str) – Second string.

  • c (str) – Third string.

  • d (bool) – Whether to include e in the concatenation.

  • e (str) – Fourth string.

Returns:

The strings concatenated together.

Return type:

str