High-Speed Digitizers

cancel
Showing results for 
Search instead for 
Did you mean: 

Typedef Error when compiling niScope for DLL using CVI

I am getting the following error when trying to compile a DLL for the NI 5122 digitizer using CVI:

Error creating type library:

All structs, unions, and enums required by exported functions must be typedefs in order to create a type library. The struct/union/enum "niScope_wfmInfo" does not use such a typedef.

I have created a variable and "typedefed" it as niScope_wfmInfo to try and get rid of this error. This did not work. I have tried making several other changes. Some have eliminated the error but created problems with the DLL.

Has anyone had a similar error to this? If so, how did you get around it?

Thanks,

Heather
0 Kudos
Message 1 of 5
(6,858 Views)
Hi Heather,

I haven't seen an error like this before. Is this a custom program that you created or is it an example program? If it is a custom program, do you get this same error when trying to create a DLL out of an example program? The example programs are located in C:\Program Files\National Instruments\CVI70\samples\niScope and I would try making a DLL out of one of the simple examples such as "Getting Started". Let me know if this works.

Thanks!

Erick D
NI Applications Engineer
0 Kudos
Message 2 of 5
(6,834 Views)
Thanks Eric,

I based my program on the NI example program called AdvancedMeasurementLibrary. I am trying to compile to a DLL so that I can export my functions to Teststand.

The exact error that I am getting can be replicated in the AdvancedMeasurementLibrary project if the following settings are changed:

1. Target Type set to Dynamic Link Library

2. Target Settings -> Type Library set to "Add type library resource to DLL"

3. Target Settings -> Type Library set function panel file to c:\VXIPNP\WinNT\niScope\niScope.fp

4. Target Settings -> Exports "Change" set to "GenericMeasurementLibrary.h"

Any help that you could provide would be appreciated.

Thanks,

Heather
0 Kudos
Message 3 of 5
(6,824 Views)
Hi Heather,

The reason that you are receiving this error is because the niscope.h file (called by niScope.fp) uses a struct which cannot be compiled into a DLL. This means that the niScope.fp file cannot be included in the target settings. Here's a knowledgebase that describes the error.

http://digital.ni.com/public.nsf/websearch/AC028D9586E947F08625661E006A182F?OpenDocument

If you do want the niScope.fp file to be included then you will need to make some modifications to the niscope.h file and create a typedef for the niScope_wfmInfo struct. Here's info from the help file that describes the type library section and the use of the .fp file.

"Type Library—This button lets you choose whether to add a type library resource to your DLL. Also, you can choose to include links in the type library resource to a Windows help file. LabWindows/CVI generates the type library resource from a function panel (.fp) file. You must specify the name of the .fp file. You can generate a Windows help file from the .fp file by using the Generate Windows Help command in the Options menu of the Function Tree Editor window.

This feature is useful if you intend for your DLL to be used from Visual Basic."

If you do not include the niScope.fp file then you will be able to compile the DLL.

Hope this helps! Let me know if you have any questions.

Erick
Message 4 of 5
(6,795 Views)
Thanks Erick,

I changed the struct in the niscope.h file to a typedef. It looks like everything is working now.

Heather
0 Kudos
Message 5 of 5
(6,787 Views)