IBM Support

Using an external dll from a Robot SQABasic script

Troubleshooting


Problem

This technote describes how to invoke a Microsoft .NET dll function from within an IBM Rational Robot SQABasic script.

Resolving The Problem

From a Robot SQABasic script you can invoke a library function that is implemented in a DLL. Enclosed below is an example of C++ code that contains the function: myDllFunction(). This code can be built into a DLL (using Visual Studio 6.0 or .NET) allowing calls to myDllFunction() from SQABasic. Note: The same mechanism should also work with DLLs written in C#, Visual Basic (VB) and other programming languages of .NET.


// This is the main DLL file.


#include "stdafx.h"
#include "mylib.h"

extern "C"
{
__declspec(dllexport) long __cdecl myDllFunction( char* s1, char* s2 )
{
return 1;
}
}
Below you can find the Robot SQABasic script that invokes the function from the DLL library. Note that the library is stored under: D:\release\mylib.dll.

Declare Function myDllFunction Lib "D:\release\mylib.dll" (Byval s1 As String, Byval s2 as String) as integer

Sub Main
    Dim Result As Integer
    Result = 0
    Result = myDllFunction("string1", "string2")
    print Result
End Sub

For additional information on how to export functions from a DLL, please refer to the MSDN Home Page and search for __declspec.


Disclaimer

All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.





[{"Product":{"code":"SSSHDX","label":"Rational Robot"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Scripting","Platform":[{"code":"PF033","label":"Windows"}],"Version":"7.0;7.0.0.1;7.0.0.2;7.0.0.3;7.0.0.4;7.0.0.5;7.0.0.6;7.0.0.7;7.0.1;7.0.1.1;7.0.1.2;7.0.1.3;7.0.1.4;7.0.1.5;7.0.1.6;7.0.2;7.0.2.1;7.0.2.2;7.0.2.3","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
16 June 2018

UID

swg21166575