07-17-2012 09:00 AM
I have a PXI system with PXIe-8101 controller. I am running a realtime operating system. I am developing my code with LabWindows\CVI. One of the things I am doing is communicationg to a Agilent 3458A multi-meter on GPIB. There is a fp file and source code (hp3458a.c) with nice function calls for this meter. The functions in the make a lot of calls to the IVI: Ivi_GetInfoFromResourceName(), Ivi_GetAttributeFlags(), Ivi_SetAttributeViString, etc. I get a bunch of link errors for these functions such as "Undefined symbol '_Ivi_GetErrorInfo".
I thought it might need IVI libraries so I tried to make it import an IVI library which was actually a random guess on my part. So I clicked on Build->Target Settings->Import Library Choices and checked the "Use IVI subdirectories" checkbox. Like I said it was a random guess on my part but it did not help anyway.
I wrote a CVI application that communicated with this device that ran on Windows operating system. I never had these linker errors with this. My guess is the projects to run on Windows OS automatically use this IVI jazz. Maybe there is a difference because on the Windows operating system I create a executable and on the real-time system the executable is in a DLL. I noticed the project for the realtime systen the Target Settings dialog looked different; it had more buttons.
I have two questions:
1.) How do I make these link errors go away?
2.) Will these work on my realtime system?
07-18-2012 09:53 AM
DPearce,
The following article may help you with installing IVI support on your real-time target: Installing IVI Support for Real-Time Targets
In order to use the IVI library, you must first install IVI support on the RT target. This can be done by installing any Modular Instruments driver.
07-18-2012 01:47 PM
I have installed lots of things on my RT target but why am I getting the link errors. I didn't get them on the Windows applications but the RT application has them. Are there some libraries linked to the project in the Windows applications the the RT applications do not have? My problem is not the RT executable (yet) ; My problem is I cannot create the DLL.
07-19-2012 03:04 PM
DPearce,
Here is the process that I followed to test this functionality on my machine. I was able to successfully build an RT dll.
Create a new folder and copy the example from \Program Files\IVI Foundation\IVI\Drivers\hp3458a\hp3458a_example.c to this new directory.
Create a new project in CVI and add the following files to the project:
- hp3458a_example.c
- hp3458a.fp (Use Instrument > Load... to navigate to \Program Files\IVI Foundation\IVI\Drivers\hp3458a\hp3458a.fp. Then drag this library from the Library Tree up to your Project Tree to add it to your proeject.)
Change the Target Type to .dll (since this is for an RT target)
Build > Target Type > Dynamic Link Library
Comment out both MessagePopup lines (61 and 69) in hp3458a_example.c, as these are Windows functions that aren't supported in the real-time environment.
Change the main function declaration (line 37) to the following: void myFunction ()
This is so we can add myFunction as an external function that can be called from the .dll that we are going to export. Eventually you will write all the functions that you need to call externally from your RT application in this manner.
Generate a header (.h) file that will include the functions that we wish to make public externally in our .dll.
/************** Static Function Declarations **************/
void myFunction ();
/************** Global Variable Declarations **************/
/************** Global Function Declarations **************/
Save the .h file and add it to our project. Your environment should look like below:
And the hp3458a_example.c file will look like below:
Change the Export settings to include this .h file:
Lastly, we can build the project into a .dll that can be called on our RT target.
Then we will see the following successful build prompt:
Can you please go through this process and see if you are also able to successfully build from this example?
07-20-2012 10:49 AM
I don't have these files on my computer. I have the fp file because I archived it with my old CVI app. Do I need to install something on my computer? Maybe that is why I have the linker errors?
07-23-2012 01:57 PM
DPearce,
Yes, this may be the issue. I was able to download and install these files from National Instruments' Instrument Driver Network at the following page:
Agilent Technologies hp3458a Meter
I chose the first download, LabWindows/CVI 8.5.
07-23-2012 03:04 PM
It did not help. First I downloaded the exe and tried to run to a directory and ran the executable manuallly. Got an error message that it was not a valid Win32 executable. Wish I would have written down the whole message now. I exited the installation.
Next I clicked on download and let it run the installation automatically. Did not see an error message. But I still get the linker error messages when I try and build the dll.
What I think is a hint is when I build a project for a Windows application I do not have a problem. But when I build the DLL for my realtime OS on the PXI system I get these linker errors. Makes me think I have something in my project for the Windows application that allows some sort of IVI library. But in the project for RT it does not link in this IVI stuff.
A real puzzler.
07-24-2012 09:40 AM
DPearce,
Are these errors appearing on your own project?
Did you try stepping through the example I posted? Do you still receive the errors when building this project from scratch?
07-24-2012 01:33 PM
Your method worked.
The only diffference I see is when I created my project I created a project from a template. The template I chose was "Real-time Target Application." Intuitively I would think that is the right one.
It automatically makes selects the target as a DLL. And it makes my main function call:
void CVIFUNC_C RTmain (void)
Which is what I thought you are suppose to do.
I am using a document I found on the NI website "GettingStartedCVIRT.pdf" (374686D-01). It says you can create a project using these templates.
thanks,
Dazed and Confused