Calling DLL Functions From Tests - Known Limitations

Applies to TestComplete 15.63, last modified on April 23, 2024

Support for calling routines implemented in dynamic link libraries (DLLs) from TestComplete tests has some known limitations. They are listed below in this topic:

  • Only standalone exported routines can be called from TestComplete tests. There is no way to call methods of exported classes.

  • The DLL routine to be called must match the stdcall calling convention.

  • DLL routines that get structures containing array-type members (for instance, string or array fields) via their parameters are not currently supported by TestComplete. See Using Custom Data Structures in DLL Function Calls for more information.

  • Currently, TestComplete cannot obtain results from Delphi routines that return interface references (for instance, IDispatch or IUnknown). For more information, see Returning Interface References From DLL Functions.

  • Currently, TestComplete does not support several string types for function results (for instance, AnsiString or char *). These string types are supported for function parameters only. Moreover, the string Delphi type is supported by TestComplete neither for function parameters nor for result values. For more information, see Using String Parameters in DLL Function Calls.

  • Native string variables created in TestComplete scripts cannot be passed to a DLL routine via its parameters. You should always create an appropriate helper variable of the LPSTR or LPWSTR data type defined in TestComplete to pass a string value via a DLL routine’s parameters. See Using String Parameters in DLL Function Calls for more information.

  • Since JavaScript, JScript and Python do not support passing variables by references via parameters of the called function, you cannot pass variables of ordinary data types (like integer, boolean, etc.) by references to a DLL routine from JavaScript, JScript, Python C#Script or C++Script tests (this limitation concerns C#Script and C++Script, because these languages are based on JScript and use the JScript engine). However, this limitation does not concern passing custom structures, arrays or string variables created by the DLL.New and IDLLAccessProcess.New methods, because these methods create special wrapper objects for such variables and these objects can be passed by reference to DLL routines from JavaScript, JScript, Python, C#Script and C++Script tests. For more information, see Parameter Types for C++ Routines and Structures and Parameter Types for Delphi Routines and Structures.

  • Compilers can align structure members at certain bounds: at bytes, words, double words, etc. When passing structures via a DLL routine’s parameters, TestComplete does not align structure members itself. Therefore, when you define custom structure types in TestComplete with the DLL.DefineType or IDLLAccessProcess.DefineType method, you should consider the alignment that was used when compiling the DLL and the actual size of structure members and specify properly the appropriate size of structure members. For more information, see Parameter Types for C++ Routines and Structures and Parameter Types for Delphi Routines and Structures.

See Also

Calling DLL Functions From Tests
Calling DLL Functions From Tests - Overview

Highlight search results