LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to build labview global variable into dll?And how to use it in vc++ program?

Hi!
   I want to build labview application into dll and use vc++ to call it.The labview program is a little complex,for it has many interface to vc++ and has while loop in it.When I use vc++ to call it,I must use vc++ to do other things.That is to say,vc++ creates a new thread to provide for the labview dll to run.the vc main thread goes on to other things.But the vc++ main thread must communicate with the labview dll by setting its inputs' parameters and get the results of running labview dll.Can you advise me how to realize it?
   I think global variable of labview could be useful when realizing the communication betweeb vc thread and labview dll.So I want to ask whether the labview global variable could also be built into dll and use it.Could you please tell me how to realize my idea?
   Thank you!:)
0 Kudos
Message 1 of 9
(4,739 Views)


xin_necc@sina.com wrote:
Hi!
   I want to build labview application into dll and use vc++ to call it.The labview program is a little complex,for it has many interface to vc++ and has while loop in it.When I use vc++ to call it,I must use vc++ to do other things.That is to say,vc++ creates a new thread to provide for the labview dll to run.the vc main thread goes on to other things.But the vc++ main thread must communicate with the labview dll by setting its inputs' parameters and get the results of running labview dll.Can you advise me how to realize it?
   I think global variable of labview could be useful when realizing the communication betweeb vc thread and labview dll.So I want to ask whether the labview global variable could also be built into dll and use it.Could you please tell me how to realize my idea?
   Thank you!:)


You can't access LabVIEW globals directly from a caller to the LabVIEW DLL. However there is no problem in providing specific accessor VI functions to that global and export them as additional functions from the DLL.

Rolf Kalbermatter
Rolf Kalbermatter
My Blog
Message 2 of 9
(4,735 Views)
Thank you for your answer!
    but I'm sorry I couldn't understand the meaning of "additional functions from the DLL".Could you please interpret it in detail?
    I don't have the manual of "Build Application or Shared Library (DLL)".So could you please tell me the use of some options?
    Such as the meaning of "Add exported VI..." "Add Dynamic VI..." "Add Support File.." in "Source Files option" and what is aim of using VI setting?
   Thank you!
0 Kudos
Message 3 of 9
(4,724 Views)
You do have the Application Builder Manual! Go to the Help menu in any LabVIEW window, Select Search the LabVIEW bookshelf and there go to the third page on top.

Well, a DLL can export several functions. The LabVIEW application builder supports that in that you can add more than one VI to the listbox in the Source Files tab. For each VI you then have to define the VI prototype and after you build the DLL those functions will be all exported by your DLL.

Rolf Kalbermatter

Message Edited by rolfk on 10-19-2005 01:41 AM

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 9
(4,717 Views)
Now I understand more.Thank you  for your answer!
 
I really know the manual about build applicationg you mentioned.But I think it help a little.
That manual only contains "Required System Configuration","Installing the Application Builder","Changes to  the Application Builder".
Only a little contects are about how to use it.Maybe that is enough for others.
 
Your answer let me be enlighted!I will try following your hint.
Thank you!
 
Xingang Zhang
0 Kudos
Message 5 of 9
(4,708 Views)

Hello,

 

I know that the topic is obsolete but please help me.

I know how to export multiple functions in one Labview dll but it seems that I cannot  get the values from one function in the other. To access these variables I created subVIs which just read these values but when calling these functions in my C code the values do not show. I tried to do that for a constant value and it works, but for shared variables it does not work.

 

Is there something I am forgetting?

 

I am trying to obtain the values in the main VI through local variables like this:

1.PNG

and the function (subVI) looks like this:

2.PNG

 

 

0 Kudos
Message 6 of 9
(3,239 Views)

There are no shared, local, or global variables anywhere in the images you show. All you have are references to front panel items. Rather than trying to get the data through references, create a VI (a functional global variable) that stores the data in one or more shift registers (you could put a cluster of several items in one shift register, or one shift register per value, whatever works for you) that you call from all the VIs in the DLL to retrieve the data.

Message 7 of 9
(3,224 Views)

Thank you for the  quick reply!

 

Think I understand what you propose. I would than have a vi (with two cameras in my case) that will SET the values of the FGV and other vis that will GET the values. These GET vis will serve as functions that I could call in the dll. If I am correct.

 

Will there be problems regarding the fast aquisition of values? My cameras are about 20 FPS and the values which I set change accordingly.

 

 

0 Kudos
Message 8 of 9
(3,213 Views)
You'll have to try it out to see if it works. If it doesn't, you'll need to provide a much more detailed description of what you're trying to do and how you're calling the DLL before anyone can give you a better suggestion.
0 Kudos
Message 9 of 9
(3,207 Views)