----- Original Message -----
From: "Jerry"
Francisco Javier Porras Gálvez
writes: Hi, all.
I don't know anything about Boost, neither OpenMP, pthread nor Windows API thread library. So, before begin learning one of these, I'd like to explain to you how I want my application to work.
It deals with running two parallel loops, one in LabView, and the other in C++. It doesn't matter if you don't know anything about LabView, this explanation is easy enough to understand. Attached you can see a picture which shows the desired execution behaviour. I want to know whether my application would be possible to achieve using Boost, or using another API. In another general C++ forum, I was suggested to use Boost.
First, the execution begins in LabView. Here, I call a dll function written in C++. This is the "initialization" function. Its aim is to create another thread that will execute the main loop in C++. Then, this "initialization" function ends, because it has to return the control execution to LabView, but the new thread which has just been created must continue executing in its own loop.
Now we have two loops in parallel: LabView and C++. In LabView's loop, we call periodically another dll function that has to send and retrieve data from the independent thread in C++. This function, like the other, has to end executing to pass control to LabView again, after it has done its purpose.
This will be the behaviour until we call from LabView another dll function to stop the independent thread (not shown in the picture). After this, the LabView program ends.
Is it possible to use Boost for this? If so, could you post a brief example about how you'd make it?
Thanks in advance,Francisco
I did something almost exactly like this about 10 years ago with LabView 7. I made a DLL that created a thread that started a socket listner so that other computers could connect to the embedded Labview to get control data.
Now, Labview allows you to create sockets, but the protocol library for the socket data was already in C++ and I tried to create the socket in Labview and pass it into the DLL but I had quite a bit of trouble. It didn't work correctly in Labview 7. I raised a ticket with NI and they basically couldn't help me because none of their help desk knew anything about making your own DLL. Hopefully the support is better now.
So anyway, I created a DLL that started a thread and created a socket listner. Then periodically I would call another function in the DLL to deposit control data that the socket listener could send to requestors. I had it start a separate thread because I was using a blocking socket listener.
It all works fine. And from Labview's point of view it doesn't matter what library you use to create the socket because all that is hidden in the DLL. I used Visual Studio's C runtime beginthread function and that worked because the embedded Labview system was running on Windows, but of course it isn't portable (neither is pthread or Windows API threads). Boost Threads is portable and would work fine.
Do you know what OS your Labview app will be running on?
Jerry
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi, Jerry. Thanks for your support! I hadn't any idea about what a socket was, but after "googling" a little and read about in NI pages, I have it clearer now. LabView uses a tool called DataSocket to share data between different applications or/and the internet. Moreover, I "discovered" that LabView includes a set of C++ libraries in what is called "Measurement Studio". One of this libraries implements also "DataSocket", and in NI forums they state is possible to share data between two applications in C++ and LabView using this DataSocket tool. So, I think this is the right direction. Your clue was really useful. Thanks, Francisco