LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW 8 Callbacks

Hi Community,
 
Have a case attached which is working fine in a similar format for LabVIEW 7.
 
Steps to reproduce:

Step 1: lv1.vi is the main routine.

Step 2: Run the file - as you can see nothing is written to mytxt.txt.

Step 3: Open c2caller.vi and run it. Observe that a line is written to mytxt.txt.

When we do the same thing in LV7 - mytxt.txt is written to.
It's not that we are interested in writing to a file, but we are getting tons of problems when doing callbacks in the way illustrated by this example.
 
If we can get this case to work - or understand why it's not working hopefully we'll find a path forward.
 
It would be fun if someone could solve this in 20 mins since it has delayed a release by XXX months now....
 
Best wishes, Marcus

Message Edited by Support on 06-13-2006 06:22 PM

Marcus M. Edvall
Tomlab Optimization Inc.
855 Beech St #121
San Diego, CA 92101-2886
USA

web: http://tomopt.com
e-mail: medREMvall@tomREMopt.coREMm
Office1: (619) 203-2037
Office2: (619) 595-0472
Fax: (619) 245-2476
0 Kudos
Message 1 of 6
(2,621 Views)

Hello medval,

It took me a little while to understand what was happening in the code.  It looks like Lv1.vi calls a function c1call with c2caller as a parameter.  C1call (a function in a dll) then calls lv2call (a LabVIEW VI ?) with c2caller as a parameter.  LV2 calls c2caller by reference, since it was passed as a reference through the whole chain.  Where in the link is it breaking down?  You should compile the dlls to have a break point so that you can tell that they are getting called.  You can also run the VIs in highlight execution mode to see that they are being called from the dlls.

If I am mistaken in the actual order or in the intended purpose please let me know.  Why is it that you are using dlls to call LabVIEW vis in this way.  Also, where is the lv2.c file or is it supposed to be using the lv2.vi for its implementation?

Steven T.

0 Kudos
Message 2 of 6
(2,598 Views)

Hi Steven et al,

Attached is the roughly the same code for LV7. I can highlight the execution and do pretty much whatever I want in c2caller.vi.

In LV8 I cannot highlight execution, neither can I write to files and such.

lv2call - this is a call to a LV generated dll - lv2.vi is the source code used for the application builder. (use lv2.bld to build the dll, or similar for LV8 in the other zip file).

To me it looks like a change in behavior for LV8 which prevents us from doing this - have no idea what is going on.

Correct, no lv2.c file exist - you have lv2.vi which is compiled from LabVIEW.

Best wishes, Marcus

 

 

 

Marcus M. Edvall
Tomlab Optimization Inc.
855 Beech St #121
San Diego, CA 92101-2886
USA

web: http://tomopt.com
e-mail: medREMvall@tomREMopt.coREMm
Office1: (619) 203-2037
Office2: (619) 595-0472
Fax: (619) 245-2476
0 Kudos
Message 3 of 6
(2,575 Views)
Hi Marcus,
 
I've tried to take a look at your code, but I must admit I'm a bit confused. What version of LabVIEW did you save your first zip file in? In the second zip file (the 7.1.1 format), I do not see anywhere in the code where you write to a mytext.txt. I hope I'm not missing something obvious here...
 
Could you clarify what you are trying to accomplish and where it is going wrong? When you say you cannot use highlight execution in LabVIEW 8, what file are your referring to? c2caller.vi? What might help is letting us know which VI's have been compiled into which DLL's.
 
Thanks!
Charlie S.

Visit ni.com/gettingstarted for step-by-step help in setting up your system
0 Kudos
Message 4 of 6
(2,539 Views)
Hi Charlie and the rest of the panel,
 
The first zip file in this thread is compiled and setup with LV8.2 Beta 13. There is no project file included for compiling lv2 since they seem to be corrupt when saved, but I assume you can make one if needed.
 
Attached is a new zip file file that writes to a file for 7.1.1. As you can see this works fine - for LV8 it doesn't work at all. Neither can I highlight the execution in LV8.
 
c2caller.vi is the point where it goes wrong - you can follow the chain of calls from lv1.vi and forward. lv2.vi is an LV compiled dll.
 
One can turn on the lamp in c2caller.vi  for LV7 but not for LV8.
 
The make files explains how the compilation was done.
 
This is the simplest test case that mimics our system for optimization in LabVIEW (TOMVIEW - http://tomlab.biz/tomview/).
 
The extent of the problems are much wider than explained above - it's virtually impossible to debug, but we hope that resolving this one (understanding why it goes wrong) will help us clear this out.
 
All the best - thanks for all the help.
 
Marcus
Marcus M. Edvall
Tomlab Optimization Inc.
855 Beech St #121
San Diego, CA 92101-2886
USA

web: http://tomopt.com
e-mail: medREMvall@tomREMopt.coREMm
Office1: (619) 203-2037
Office2: (619) 595-0472
Fax: (619) 245-2476
0 Kudos
Message 5 of 6
(2,530 Views)

Hi Marcus,

Thanks for the clarification. I tried running your code in 8.0.1 and sure enough, it did not write anything to mytxt.txt. However, I believe the reason for this is that the LabVIEW-built DLL was invoking the wrong version of the runtime engine. I created a new project and build specification from your .bld build script file (under Tools >> Convert Build Script...). With the new lv2.dll I was able to successfully run the code and write to mytxt.txt!

I have attached the modified code that worked on my machine. Perhaps you can upgrade to 8.0.1 if it still does not work on your machine.

Hope this helps!

Charlie S.

Visit ni.com/gettingstarted for step-by-step help in setting up your system
0 Kudos
Message 6 of 6
(2,499 Views)