LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

errors creating import library BORLAND LabWindows CVI

Hi,

We are writing an application to control a spectrometer via the USB interface using Labwindows CVI 7.0.

We are trying to generate the import library for an instrument (avaspec -2048-2-USB2 spectrometer). We have the as5216.dll library and the corresponding header file as5216.h. We encountered errors when using the procedure to create the as5216.lib file in CVI 7.0. We know from the company that provided us the insrtuments and files that the DLL library they provided exports the functions in standard C (not C++) but the header file seems to contain some declarations that conflict with CVI. We are getting an error   "as5216.h"(107,56)   Integer expression must be constant. We have about 20 errors of this sort. We here attach the header file. Can anybody give us some clue about how to solve these errors?. Any help will be much appreciated.

 

Fundadero 

 

0 Kudos
Message 1 of 13
(4,683 Views)

Hi,

 

from the error message I would expect that you may not use something like

 

uint16 const    SETTINGS_RESERVED_LEN   = ((62*1024) -  sizeof(uint32) -...

 

What should work is to calculate this length by yourself and enter a fixed number.

 

Wolfgang

0 Kudos
Message 2 of 13
(4,673 Views)

The line on error is this one:

    float                   m_aFit[NR_WAVELEN_POL_COEF];
where you have previously defined NR_WAVELEN_POL_COEF as a char const.

 

It seems that CVI compiler makes a difference between a constant expression and a variable specified as const while other compilers don't.

 

By changing declarations as follows:

#define NR_WAVELEN_POL_COEF     5

you should be able at least to compile succesfully.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 13
(4,655 Views)

Hi Roberto,

 

I didn't try to include and compile the file provided by Fundadero, but his error message

 

Integer expression must be constant

 

suggested to me that I had to look for an integer expression, while you referred to a different line with the definition of a float... In this line there is no integer at all? I am sure you are right, but I don't understand it...

 

Wolfgang

0 Kudos
Message 4 of 13
(4,647 Views)

Wolfgang,

 

The compiler is complaining that the array size needs to be an integer constant. Another coffee, maybe? Smiley Very Happy

 

JR

Message 5 of 13
(4,639 Views)

Hi JR,

 

Thanks for the coffee Smiley Happy

0 Kudos
Message 6 of 13
(4,635 Views)

Hi JR,

 

I don't know if Fundadero has solved his problem by now - but for me this thread was quite valuable: In my aging memory I had the definition that

 

A header file is a file containing C declarations

 

This, indeed, is way too strict as I have learned in the coffee break... Thanks again for being lenient Smiley Happy

 

Fundadero, sorry for the false suggestion, now I know better...

Message 7 of 13
(4,607 Views)

Dear Wolfgang, JR and Roberto,

Thanks for all your comments. We have tried to replace the declarations that used const and replaced them with precompiler #define declarations. In addition, we evaluated the size of the constant

 

              uint16 const    SETTINGS_RESERVED_LEN   = ((62*1024) -  sizeof(uint32) -
                                                        (sizeof(uint16) +   // m_Len
                                                         sizeof(uint16) +  // m_ConfigVersion
                                                         USER_ID_LEN +..

 

which ended up being 13800 in LabWindows CVI. Up to this point wverything was ok.

 

Then I also replaced the declarations  of the error values which where of the sort

 

           // Return error codes
            /*
          int const ERR_SUCCESS                   = 0;
          int const ERR_INVALID_PARAMETER         = -1;
          int const ERR_OPERATION_NOT_SUPPORTED   = -2;

 

by precompiler definitions:

 

          #define ERR_SUCCESS                   = 0;
          #define ERR_INVALID_PARAMETER         = - 1;
          #define ERR_OPERATION_NOT_SUPPORTED   = -2;

 

These definitions may have been ok as they where but I thought that it will not hurt to do it this way.

 

When I tried to generate the import library using the header file with the modicications that I mentioned, I get a different error:

 

"Unble to generate DLL glue code. Error in header file "d:\ As5216.h" at line 363, clumn 1: sintax error; found 'string constant' expecting ';'

 

 

I checked to see if there was any semicolon left fromthe previous declarations, but I do not see any.

What could be the reason to thhis new error?.

 

Another question is , what is the DLL_API modifier mean?.

 

I appreciate any suggestions. Thanks for helping us already.

 

Regards,

 

Fundadero

 

 

and so on.

 

0 Kudos
Message 8 of 13
(4,557 Views)

To understand the cause of that error we should beable to examine the file after your modifications. In any case, you must delete all semicolons at the end of each #define line.

Did you try to compile the file before changing the CONST to #define?



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 9 of 13
(4,550 Views)

Hi Roberto,

 

 

No I did not try to compile the file. But i did not find extraneous semicolons. I have a header file and a dll file and i am trying to generate the import library to be able to call functions from a CVI program.

I attach the header file. Do you want me to attach the dll file?.

 

Thanks for your help.

Download All
0 Kudos
Message 10 of 13
(4,539 Views)