 tomii
		
			tomii
		
		
		
		
		
		
		
		
	
			01-19-2013 03:16 PM
Hello, all.
I am trying to get an Opal Kelly XEM3005 board up and running with LabWindows/CVI 8.5.
I have been in touch with OK's Tech Suppt, and have run down the initial issues of "bool" types. After having (at OK's recommendation) with "char" types, I can now include the headers without errors.
There is, however, a new problem:
When I call the constructor function, which should return a pointer to an "okFrontPanel_HANDLE" type, I am getting an error for a missing prototype for the constructor(s).
Dredging through the .c(pp) file, I found the following:
//----------------------------
Relevent code snippets included below:
~~~~~~~~~~~~~~~~~~~~~~~~
try1.c:
#include <cvirte.h>        
#include <userint.h>
#include "Try1.h"
#include "XEM.h"
#include <windows.h>
//#define _WIN32
static int panelHandle;
static okFrontPanel_HANDLE    XEM_Device;
int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                       LPSTR lpszCmdLine, int nCmdShow)
{
    if (InitCVIRTE (hInstance, 0, 0) == 0)
        return -1;    /* out of memory */
    if ((panelHandle = LoadPanel (0, "Try1.uir", PANEL)) < 0)
        return -1;
    DisplayPanel (panelHandle);
    RunUserInterface ();
    DiscardPanel (panelHandle);
    return 0;
}
int CVICALLBACK Connect (int panel, int control, int event,
        void *callbackData, int eventData1, int eventData2)
{
    int    Value = 0;
    
    switch (event)
    {
        case EVENT_COMMIT:
            GetCtrlVal(PANEL, PANEL_CONNECT_SWITCH, &Value);
            SetCtrlVal(PANEL, PANEL_CONNECT_LED, Value);
            
            if( Value )
                XEM_Connect(XEM_Device);
            else
                XEM_Disconnect(XEM_Device);
            
            break;
    }
    return 0;
}
int CVICALLBACK Quit (int panel, int control, int event,
        void *callbackData, int eventData1, int eventData2)
{
    switch (event)
    {
        case EVENT_COMMIT:
            QuitUserInterface (0);
            break;
    }
    return 0;
}
~~~~~~~~~~~~~~~~~~
XEM.c:
int XEM_Connect ( okFrontPanel_HANDLE    XEM_Device )
{
    int    NoDevices = 0;    //    Number of devices attached to the PC
    
    //    Load the DLL (?)
    // Load the FrontPanel DLL
    if (FALSE == okFrontPanelDLL_LoadLib(NULL)) 
    {
        printf("Could not load FrontPanel DLL\n");
        exit(-1);
    }
    
    //    Find out how many devices are attached
//    XEM_Device = okFrontPanel_Construct();
    XEM_Device = okCFrontPanel();
//    NoDevices = okCFrontPanel();
    printf("%d OK devices attached\n", NoDevices);
    
    //    Call the contructor?    
//    okCFrontPanel ();
    return XEM_SUCCESS;
}
int XEM_Disconnect ( okFrontPanel_HANDLE    XEM_Device )
{
    
    //    Call the Destructor (?)
//    ~okCFrontPanel ();
    return XEM_SUCCESS;
}
Solved! Go to Solution.
01-21-2013 10:16 AM
Hi tomii,
It looks like you posted another very similar thread about compiling errors with your Opal Kelly dll's here. I will be following up in that thread to help get some traction with these issues.
01-21-2013 10:28 AM
Well, I started this new one to give more info, as things have progressed some, and the answers I was getting in the other were not especially helpful.
Right now I'm at a linking problem (I think)
01-21-2013 10:28 AM
Let me rephrase. Yes, there is a new thread with much more recent info in it. Sorry for the confusion