LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI fails to compile extcode.h (labview include file) and any toolbox fp file in CVI

My application needs a DLL from Labview 8.2 (to reboot a RealTime target). Labview automatically builds a c-style include file for the dll function prototype and a "#include extcode.h" statement in that prototype file. So far so good. I can use the DLL with no problem at all. Now when I start adding some of the CVI functions (e.g. Ini_New, Ini_WriteToFile) from ..\toolslib\toolbox\inifile.h, the compiler fails with all errors pointing to the extcode.h file. In fact, I believe extcode fails to work with any of the functions in the toolbox group! Does anyone know a work around? Thanks.
0 Kudos
Message 1 of 14
(9,714 Views)
Hi AcquirisUser,

Please make sure you are following all the steps located in the following Knowledge Base

Calling a LabVIEW DLL from a CVI or other C/C++ project

If you are following all of these steps, what version of CVI are you using?

Brandon Vasquez | Software Engineer | Integration Services | National Instruments
0 Kudos
Message 2 of 14
(9,694 Views)
Hi Brandon,
As I mentioned in the post above, I have no trouble running my LV Dll with my CVI application. The CVI compiler fails even by just adding any of the following header files in my application:

These files are all in ..\CVI80\toolslib\toolbox folder:

1. Inifile.h
2. toolbox.h
3. cvixml.h
4. menuutil.h
5. regexpr.h

Here is what I found out:

1. If any of the above file was added before calling the LV's ExtCode.h header file, then the CVI compiler would get a bunch of syntax errors in ExtCode.h file and two redeclaration errors of "Pin" and "BinSearch".  The errors have something to do with different calling convention declared in toolbox.h:458 and line 583, respectively.

2. If it is placed after ExtCode.h in the header file, then I'd get only three errors - all are the "redeclaration with different calling convention" of "Pin", "BinSearch", and "SwapBlock". But this time the errors are in the ExtCode.h file, lines 437, 546, and 611.

I am using CVI 8.0.1 and LV 8.2.

Thanks.
0 Kudos
Message 3 of 14
(9,688 Views)
If you comment out the ExtCode.h, does your application compile and run correctly? I believe the problem lies in the fact that this LabVIEW include and the CVI libraries both declare the same thing and it should be able to run correctly without this include file.

Brandon Vasquez | Software Engineer | Integration Services | National Instruments
0 Kudos
Message 4 of 14
(9,684 Views)
If ExtCode.h is commented out, then LVBoolean is now undefined in my DLL function prototypes. I'll try going back to my LV code and check if I can leave LVBoolean out and recompile this whole project. Thanks.
0 Kudos
Message 5 of 14
(9,679 Views)
Do you not need LVBoolean in your project? If you don't then removing it should be fine, but if you are using LVBoolean in the project we will need to find another way.

Brandon Vasquez | Software Engineer | Integration Services | National Instruments
0 Kudos
Message 6 of 14
(9,657 Views)
I beleive I had silimar errors and I ended up commenting out "Pin", "BinSearch", and "SwapBlock" in extcode..
Thanks.
CVI 2010
LabVIEW 2011 SP1
Vision Builder AI 2011 SP1
0 Kudos
Message 7 of 14
(9,651 Views)
In the LV project, I just used  numeric control as input, convert it to LV Boolean and feed it into other vi. Same for the output, convert LV Boolean values to just 0s or 1s in integer type. So now all the LV specific data types are hidden and my lv dll works perfectly without using the extcode.h file!
0 Kudos
Message 8 of 14
(9,642 Views)


@sheetal wrote:
I beleive I had silimar errors and I ended up commenting out "Pin", "BinSearch", and "SwapBlock" in extcode..



This is the most sensitive solution. I would however not comment them out but instead conditionally compile them based on an include file define defined by toolbox.h. Then make sure to include toolbox.h before extcode.h. Will keep your extcode.h in original state for other projects not including toolbox.h.

Of  course the opposite of conditionally compiling the toolbox.h functions based on a define from the LabVIEW extcode.h will work too unless you use those CVI functions.

Rolf Kalbermatter

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 9 of 14
(9,604 Views)
I made local copy of extcode.h to my project dir and then modified. So it was applicable to that project only.
Thanks.
CVI 2010
LabVIEW 2011 SP1
Vision Builder AI 2011 SP1
0 Kudos
Message 10 of 14
(9,596 Views)