09-30-2009 01:05 PM
I have a Test Executive that is run on two different test stands. Each stand has a different ARINC429 card. The older card uses 429dll32.lib while the newer card uses pci429.lib. The Test Exec code will only load one library file (using LoadExternalModule) depending on what card the test stand has, but since there are many similar functions in both, CVI will not allow Test Exec to be built as a standalone executable.
In CVI 5.0.1, I open the "Create Standalone Executable" window and select "Add Files to Exectuable". I check both 429dll32.lib and pci429.lib to include them in the executable creation and click "OK". When I click"OK" to create the executable I get several link errors, one for each function both .lib files have in common.
Is there a way for both of these .lib files to be included in the build without having to create two separate executables?
Solved! Go to Solution.
09-30-2009 05:30 PM
If I understand it correctly, your problem lies in having the libraries both defining a function with the same name but different parameter list. If this is the case you should be able to replace function name between the load of the #include files for the libraries, this way:
// Process the older library functions
#include "429dll32.h"
#define 429_SomeFunction 429_SomeFunction_Old
#undef 429_SomeFunction
// Process the newer library
#include "pci429.h"
At this point you should be able to access both 429_someFunction_Old and 429_SomeFunction without problems. I suppose you have a global flag indicating wether you are using the older library or the newer one, so every time you need to call that function you may switch depending on that flag:
if (newer)
429_SomeFunction (....);
else
429_SomeFunction_Old (....);
I never had a similar problem so I have not tried such an environment but I am confident it should work.
09-30-2009 06:22 PM
eatmontr:
If you are using LoadExternalModule(), you don't need to include the .lib files in the test executive project. See the CVI help for LoadExternalModule.
Here's some of the help info:
LoadExternalModule loads an external object module file. You do not need to list the file in your project or load it as an instrument module.
The file can be an object file (.obj), a library file (.lib), or a DLL import library (.lib).
Here are a couple of NI articles that may help.
Accessing External Modules with CVI (with sample program) http://zone.ni.com/devzone/cda/epd/p/id/133
How Do I Call DLLs If I Have Two Identically Named Functions in Two Different DLLs? http://digital.ni.com/public.nsf/allkb/5299ED8D43F3B5FE852563BF0056EBA6
10-01-2009 12:22 PM