This function returns the API's version(major.minor.version). Basically, it returns COMMAND_LAYER_VERSION. The vector contains 3 values. The first one is the version, the second one is the major and the last one is the minor.
- Parameters:
-
| Response | A vector that contains the version number of this library. |
#include <iostream>
#include <dlfcn.h>
#include <vector>
using namespace std;
int main()
{
int result;
std::vector<int> data;
cout << "GetAPIVersion function example" << endl;
void * commandLayer_handle;
int (*MyInitAPI)();
int (*MyCloseAPI)();
int (*MyGetAPIVersion)(std::vector<int> &);
commandLayer_handle = dlopen("Kinova.API.USBCommandLayerUbuntu.so",RTLD_NOW|RTLD_GLOBAL);
MyInitAPI = (int (*)()) dlsym(commandLayer_handle,"InitAPI");
MyCloseAPI = (int (*)()) dlsym(commandLayer_handle,"CloseAPI");
MyGetAPIVersion = (int (*)(std::vector<int> &)) dlsym(commandLayer_handle,"GetAPIVersion");
if((MyInitAPI == NULL) || (MyCloseAPI == NULL) || (MyGetAPIVersion == NULL))
{
cout << "Unable to initialize the command layer." << endl;
}
else
{
cout << "The command has been initialized correctly." << endl;
result = (*MyGetAPIVersion)(data);
cout << "API's version is : " << data[0] << "." << data[1] << "." << data[2] << endl;
}
return 0;
}