08-07-2014 08:19 AM
Good afternoon,
I have a problem I cannot solve at all. I have an understoodable VI. It runs properly. I can make a dll of this VI. And I want to call this dll in another program. The problem is, I have to wrap the dll with VS 2003 C++ to run in Digital Micrograph. When I call the dll, I can not control it since I cannot access to the graphical interface of Labview. Is there a way to export the graphical front panel in another software on the basis of a dll ?
Thanks for any help.
Solved! Go to Solution.
08-07-2014 08:35 AM - edited 08-07-2014 08:36 AM
I am not sure if you are able to view the front panel elements to manually change them, but you can set up the front panel elements using the Connector Pane and then reference them in the function prototype during the DLL build:
2. Build a DLL using the Build Specifications item in the Project
3. Export your VI in the Source Files section in the pop-up that lets you configure your VI.
4. Once you click the blue arrow in step 3, you will be presented with a new popup to configure the function prototype (how you will call the function in Visual Studio).
This is where you can map the front panel elements to the C function. The "x", "y", and "return" refer to the controls/indicators in the first image. (For instance, the sample VI I used just summed 2 numbers using "add" function.)
NOTE: You must have the LabVIEW Run Time Library installed on any computer where you wish to reference this DLL.
08-07-2014 08:40 AM
I thank you very much for your answer. But unfortunately, I knew this and I did this. The problem is when I execute this, there is a general loop in the VI. This loop does not stop unless we click stop. And by a C++ language, I cannot send a stop like it is done in Labview to stop the loop.
08-07-2014 08:43 AM - edited 08-07-2014 08:44 AM
@gautierdufourcq wrote:
I thank you very much for your answer. But unfortunately, I knew this and I did this. The problem is when I execute this, there is a general loop in the VI. This loop does not stop unless we click stop. And by a C++ language, I cannot send a stop like it is done in Labview to stop the loop.
Oh... I see. Now I understand 😉
In that case, I personally would just re-write that little segment. For instance, have the code wait for a TCP command to stop. Then instead of clicking a button to stop, you can have the C++ code send a command to stop.
Perhaps someone with a little more familiarity with LabVIEW built DLLs can suggest a more elegant solution.
08-07-2014 08:50 AM
08-07-2014 09:01 AM
Thank you again. I want to control temperature and I want to stop when I want or I want to communicate with the dll like if I was with Labview. But I can change values when the dll is running because it behaves like a C++ function.
08-07-2014 09:03 AM - edited 08-07-2014 09:05 AM
@gautierdufourcq wrote:
Thank you again. I want to control temperature and I want to stop when I want or I want to communicate with the dll like if I was with Labview. But I can change values when the dll is running because it behaves like a C++ function.
Then similarly to my last post, why even bother with a DLL? You are looking for something more like interprocess communication -- TCP (easiest in my opinion), shared memory, files, etc.
I highly recommend a client/server setup using TCP. I use this a lot as it is quite basic and LabVIEW has excellent VIs to do this.
EDIT:
I just thought of another idea... you could make a DLL function that triggers a stop boolean to flick. Then you could have a "stop()" function in the LabVIEW DLL. That may just work. For instance using a queue, functional global, etc.
08-07-2014 09:08 AM
08-07-2014 11:50 AM
The fact is, my software (DM), can only understand dll. So I must build dlls. So, it can be a bad solution, it is probably one, but I cannot do otherwise. Then, my knowledges are limited and I do not know TCP for daq. Is it possible to implement things like queue, create particular functions to handle values from C ? But I do not understand what you mean.
08-07-2014 01:02 PM