Kinova API Documentation
KINOVAAPIUSBCOMMANDLAYER_API int InitAPI ( void  )

This function initialises the API. It is the first function you call if you want the rest of the library.

#include <iostream>
#include <dlfcn.h> //Ubuntu only
//Note that under windows, you may/will have to perform other #include

using namespace std;

int main()
{
        int result;

        cout << "InitAPI function example" << endl;

        //Handle for the library's command layer.
        void * commandLayer_handle;

        //Function pointer to the API's functions.
        int (*MyInitAPI)();
        int (*MyCloseAPI)();

        //We load the library (Under Windows, use the function LoadLibrary)
        commandLayer_handle = dlopen("Kinova.API.USBCommandLayerUbuntu.so",RTLD_NOW|RTLD_GLOBAL);

        //We load the functions from the library (Under Windows, use GetProcAddress)
        MyInitAPI = (int (*)()) dlsym(commandLayer_handle,"InitAPI");
        MyCloseAPI = (int (*)()) dlsym(commandLayer_handle,"CloseAPI");

        //If the was loaded correctly
        if((MyInitAPI == NULL) || (MyCloseAPI == NULL))
        {
                cout << "Unable to initialize the command layer." << endl;
        }
        else
        {
                cout << "InitAPI() is initialized correctly." << endl;
                cout << "Calling the method InitAPI()" << endl;

                result = (*MyInitAPI)();
                cout << "result of InitAPI() = " << result << endl;

                (*MyCloseAPI)();
        }

        return 0;
}
 All Classes Files Functions Variables Enumerations Enumerator Defines