LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

LabwindowsCVI Development

Hello,
I'm currently working with Labwindows CVI 7.1.
I want to create a stand alone executive software application.  I need this executive to be able to 'Load' objects or executables developed by various test developers (the objects or executables implement tests specific to the developers hardware needs and requirements) for execution.  How would I do this in LabwindowsCVI ?  How could information collected by the current object/executable be conveyed back to the executive ? 
 
Ultimately I would like the executive application to be able to cycle thru a list of objects or executables.
 
 
 
 
RTyson
   
0 Kudos
Message 1 of 11
(4,756 Views)
What you are describing is a pretty serious undertaking in any language.  Have you looked at Test Stand, it has the capability you describe.  If you do want to roll your own the most strait forward method is to put your test functions into DLLs and load them from the executive at runtime using an external lookup table.  An alternative is to create your executive as a dll and have it "called" by your test exe files. 

Message Edited by mvr on 11-10-2005 10:16 AM

0 Kudos
Message 2 of 11
(4,739 Views)

Thanks for the response.  I was looking at the following CVI lib functions;

LoadExternalModule,  GetExternalModuleAddr / RunExternalModule,

My understanding of these CVI lib functions is that I can have a developer write his test software(LabWindows CVI) module(s), compile it into its own obj(s) and with the executive access/run his test software(objects) via LoadExternalModule & GetExt......

The module & function name(s) could possibly be provided via an ' ini ' configuration file (always interrogated the same way  by the Executive)  that the test developer must use to include his modules path(s),  module name(s) and module function name(s). 

Do I have the correct understanding of these functions or Not.  Please comment !

 

RTyson
0 Kudos
Message 3 of 11
(4,727 Views)

You are on the right track. You can definitely do it with those functions.  An alternative is to use the Windows SDK LoadLibrary() and GetProcessAddress() functions.  It depends how independent of CVI you would like to be.  It is about the same level of work for both (don't use the SDK if you are using the CVI base package and do not have the windows sdk from some other microsoft product installed). 

Using an ini for the test table works fine, CVI has an instrument driver (.fp) that makes ini access pretty simple.  You can also use a simple text file or the ever popular .csv format that would allow your test tables to be constructed from excel.  The coding is not the hard part, honestly it is the design, and limiting the feature creep that occurs with this type of project.

You will need to define how you pass parameters to/from functions.  Two common ways to pass them generically are the use of pointers to voids, and variable argument lists. 

Good Luck!

0 Kudos
Message 4 of 11
(4,724 Views)
Thanks very much for the respone & responsiveness as well as the extra hints of information given.  I plan on trying this in a small test project.
I look forward to your input on other questions I may have in the very very near future as I embark on this project.  May I ask what is your level/expertise of Labwindows CVI uasge ?
 
 
 
 
RTyson
0 Kudos
Message 5 of 11
(4,721 Views)
I have been using CVI for more than 5 years now.  Not constantly, but I am pretty comfortable with it.  You can't find a better c compiler for test development.  There are a lot of very helpful and experienced CVI users here in this forum.  Some of them work for NI and can provide answers to the most difficult questions.  
0 Kudos
Message 6 of 11
(4,717 Views)

I developed a small project and that worked fine but I ran into a problem when an object calls another object.  Shouldn't the object being called have the required knowledge of the object it is calling ?

ex.

defined in test1.c     myfuncA calls test_PowerUp and test_Init

defined in test2.c    test_PowerUp,  test_Init

test1.c & test2.c objects are in the same project and have been checked - test1 has no problems calling and running test2 functions.

When I Load test1 object and test1 myfuncA function into my executive it runs myfuncA without any problem but when myfuncA calls test_PowerUp and test_Init (Commented Back Into test1.c) test1.c module Loads OK but I get a 'Undefined references' error for the GetExternalModuleAddr

Anyone ever work with this or have any answers as to why the calls in test1.c are undefined at this point ?  Shouldn't test1 object contain all references pertaining to test2 ?  My executive doesn't have to know anything about test2 object ?

I asked the question in a seperate thread but how would I compile to get a .obj file not a nidobj or niobj ?  The help contents indicates I should access by selecting Options>>Create Object File ----  Where is this ?  Did not see it in the Options pulldown menu ?

RTyson

 

 

 

 

called

0 Kudos
Message 7 of 11
(4,709 Views)
Continued playing with my project and determined that if I build a DLL of exported functions and use the dll's import library to Load into my executive and to GetModuleAddr it all works well.  This is somewhat the same as using a dll in your project with an #include <dll.h> but instead of the include statement you load the dll's import library LoadExternalModule ("dll.lib") and it seems to work the same. 
 
This load method may perhaps provide more flexibility since I should be able to change the "dll.lib" on the 'fly' during my software execution.  The include method seems to be more static.
 
 
 
 
RTyson 
 
0 Kudos
Message 8 of 11
(4,690 Views)
Your right that after your test exec loads test1 it can call test 1 without issues.  But test 1 will not yet be able to call into test2. 
obj files contain symbol tables.  These contain the names of the functions, but not where they are located.  "where" is handled by the linker.  Since you are loading the obj dynamically, the link is handled when the obj is loaded. 
In your example, test 1 is loaded, so the symbol table gets "fixed up" so that it is linked correctly.  But when test 1 calls into test 2, the functions in test 2 have not yet been linked.
 
The solution is to use one of the functions you call in test 1 to perform a load of test2.obj before you call anything inside test2.  The test executive still knows nothing about test 2.  The connection between test2 and test 1 is handled entirely within test1.
 
Options>>Create Object File is second from the bottom in the options menu.  It will only be available if you currently have a .c file as the active window.
 
 
0 Kudos
Message 9 of 11
(4,672 Views)

Thanks MVR for the explanation !

 

RTyson

0 Kudos
Message 10 of 11
(4,667 Views)