Developing a QNI module

A QNI module is a DLL that implement one or more functions following the QNI prototype.
The QNI.h file must be included before any QNI function declaration and the DLL must link with the QNI.lib library.

The QNI prototype is shown below:

QNI_FUNCTION(function_name, param_type param1, param_type param2, ...);

Parameters:

function_name

The name of the QNI function.

param_type

The type of each parameters, the available type are:

QNI_INT_IN  An input only integer parameter.
QNI_INT_INOUT  An input-output integer parameter.
QNI_CHAR_IN  An input only string parameter.
QNI_CHAR_INOUT  An input-output string parameter.
QNI_FLOAT_IN  An input only double parameter.
QNI_FLOAT_INOUT  An input-output double parameter.
QNI_VOID  No parameters. If QNI_VOID is used, no other parameters can be specified.

param1, param2, ...

The name of each parameter. Empty if QNI_VOId is specified.

Example:

#include "QNI.h"

// Multiply two input integers and return the result
QNI_FUNCTION(Multiply, QNI_INT_IN a, QNI_INT_IN b)
{
    // Use the getvalue() function to retrieve parameter values.
    int iResult = a.getvalue() * b.getvalue();
    return iResult;
}

// Concatenate two input strings, put the result in the third parameter and return 1 to indicate success.
QNI_FUNCTION(Concatenate, QNI_CHAR_IN a, QNI_CHAR_IN b, QNI_CHAR_INOUT szResult)
{
    // Use the getvalue() function to retrieve parameter values.
    std::string szTmp = a.getvalue();
    szTmp += b.getvalue();

    // Use the setvalue() function to assign a value to a parameter.
    szResult.setvalue(szTmp.c_str(), szTmp.size());

    return 1;
}

Initialize QNI module:

AgileLoad calls functions that initialize and uninitialize a QNI module. These functions allow to perform actions after loading and before unloading a QNI module. These functions aren't mandatory and are called once.

Example:

#include "QNI.h"

extern "C"
{
  __declspec(dllexport) bool QNIInit()
  {
    // Todo:
    return true;
  }

  __declspec(dllexport) bool QNIUninit()
  {
    // Todo:
    return true;
  }
}

QNI_FUNCTION(Multiply, QNI_INT_IN a, QNI_INT_IN b)
...





Go back to the Learning center:


Copyright © AgileLoad. All rights reserved.
Agile Load testing tool| Contact AgileLoad | Terms of Use | Sitemap