LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Default Params and old vi.

Hi, I'm having an issue with my vi and an upgraded DLL.  The DLL is written in cpp.  My original dll had a function like this:
 
extern "C" int foo(int x);
 
When my function was like this I was able to call it via many different vi's.  Only now I have recompiled my DLL and changed the function to look like this:
 
extern "C" int foo(int x, int y=0);
 
While TestStand does not mind the addition of the default param (y).  This is completely shutting down any attempt to call the function with my old vi.  Is there a way to fix this problem without editing every vi that calls my function?
0 Kudos
Message 1 of 5
(2,841 Views)
Sorry, you will have to edit every vi that calls the DLL function.  There is no way to globally add parameters to Call Library Nodes.
- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 5
(2,826 Views)

Hi evard,

It sounds like your "old vi" calls a DLL function using a Call Library Function (CLF) node and the DLL has changed.  The CLF needs to be edited so that it knows about the new "y" parameter.  If not updated, not enough memory will be allocated (by the CLF) for all the function parameters that the new DLL returns, and your DLL will try to corrupt memory.  How TestStand can cope with this, I don't know, but sincere Kudos to the developers of TestStand!

If the DLL function is called in multiple diagrams, then the associated CLF should be "wrapped" in a sub-VI.  If this were the case, now, there would only be one CLF to modify!

Sorry! Hope it helps anyway!

 

 

When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 3 of 5
(2,821 Views)
Thanks for the help.
 
Ok, lets assume that I change my vi to work with the newer function:
 
extern "C" int foo(int x, int y=0);
 
At the same time can I change the vi to avoid this problem in the future?  Is there a calling mode or a setting that will copy the way TestStand calls dlls?  If someone is likely to add yet another default param and I don't want to change any vi's?
 
 
0 Kudos
Message 4 of 5
(2,808 Views)
The best thing to do is to have only one vi call the DLL function.  Then all other vi's can use this as a subvi.  I have a project that required calling over 60 functions in a DLL.  I wrote 60 subvi's that do nothing but call a DLL function.  My main or other subvi's call the subvi's for functions.  If one function in the DLL changes, I only have one vi to change.
- tbob

Inventor of the WORM Global
0 Kudos
Message 5 of 5
(2,796 Views)