LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Building LabWindows 2017 GUI using Microsoft compiler - Error -86

As we work on migrating away from LabWindows, I began trying to build a simple one-panel GUI program using the Microsoft C compiler. I am using the free Code::Blocks IDE. It came with GCC, but allows using other compilers. Once I had it set up to use the MSVC compiler, I was able to build my test app just by linking to some LabWindows .lib files, and adding some Windows .libs it needed.

 

But when I run, I get this:

AllenInIowa_0-1749563968879.png

I then learned about generating a .c file that is supposed to resolve this. The .c file looks like this:

#pragma pack(4)
typedef struct {char *name; void *address; unsigned long isFunction:1; unsigned long reserved:31;} ExeSymbol;
int __cdecl ClickMeButtonCB (int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
int __cdecl panelCB (int panel, int event, void *callbackData, int eventData1, int eventData2);
int __UICallbackSymbolCount = 2;
ExeSymbol __UICallbackSymbols [2] =
{
 {"_ClickMeButtonCB", (void*)ClickMeButtonCB, 1, 0},
 {"_panelCB", (void*)panelCB, 1, 0}
};

However, when I add this to my project and build it, I still get the same error. I have verified it is linking the proper names (if I change the function name in this table, or change the function name itself, I get linker errors).

 

Perhaps I am missing some lib or something? Anyone have any tips?

 

TO GET IT TO WORK we were able to convert the panel to a .c and .h and change from using LoadPanel() to the generated BuildPanel() routine. Adding those .h and .c files produces a working GUI program, compiled by MSVC in an external IDE. Nice.

 

But we have hundreds of panels, and it would save much time just being able to generate these table files and add them and use the LoadPanel() with the .uir files.

 

0 Kudos
Message 1 of 2
(77 Views)

Using Build -> External Compiler Support... lets us specify a .c file to be generated based on the callbacks in the panel:

AllenInIowa_0-1749822430251.png

This generates a file with a table. The table contains an entry for each callback in the panels:

#pragma pack(4)
typedef struct {char *name; void *address; unsigned long isFunction:1; unsigned long reserved:31;} ExeSymbol;
int __cdecl AcceptControlLBandCalibrationDataCB (int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
int __cdecl AcceptControlSBandCalibrationDataCB (int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
...snip....
int __cdecl WriteControlSavedDataToFileCB (int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
int __cdecl WriteExciterSavedDataToFileCB (int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
int __UICallbackSymbolCount = 458;
ExeSymbol __UICallbackSymbols [458] =
{
 {"AcceptControlLBandCalibrationDataCB", (void*)AcceptControlLBandCalibrationDataCB, 1, 0},
 {"AcceptControlSBandCalibrationDataCB", (void*)AcceptControlSBandCalibrationDataCB, 1, 0},
...snip...
 {"WriteControlSavedDataToFileCB", (void*)WriteControlSavedDataToFileCB, 1, 0},
 {"WriteExciterSavedDataToFileCB", (void*)WriteExciterSavedDataToFileCB, 1, 0}
};

This seems to be "remembered" in the LabWindows project. If you remove a panel, or add a new callback, this .c file is automatically regenerated. Very nice.

 

But, simply adding this .c to my project and building builds, and tries to run, but gives this error:

AllenInIowa_1-1749822655420.png

I know it is resolving the callbacks. If I change the name of one of the items in the table, it will not link.

 

Does anyone here know what step I am missing?

 

I am trying to build this in Visual Studio using the Microsoft C compiler.

0 Kudos
Message 2 of 2
(15 Views)