-1

I call a DLL written in C++ (VS2012) from a software (LabView) and what it does is uploading a file on a server via FTP.

While the DLL is uploading the file (15MB) it does not let LabView continue with other tasks. How could this problem be solved?

LppEdd
  • 20,274
  • 11
  • 84
  • 139
  • Threads or processes? – Some programmer dude May 30 '13 at 13:37
  • Yes, separate thread, but how could this be done? Have you got any link that could help? – LppEdd May 30 '13 at 13:49
  • i don't think anybody could realy help you with so little information. since you are ussing vs2012 you can use c++11 [std::thread](http://en.cppreference.com/w/cpp/thread/thread). or you also can use [boost::thread](http://www.boost.org/doc/libs/1_53_0/doc/html/thread.html) – user1810087 May 30 '13 at 13:56
  • I understand but while it is uploading it wont give me back the control of the main application even if I use multithreading I think! – LppEdd May 30 '13 at 14:07
  • try it. make the upload function run in a separate thread. – user1810087 May 30 '13 at 14:15

2 Answers2

3

Regardless of what you have to do on the C++ side to make the call threadsafe, you will need to configure the call in LabVIEW not to run in the UI thread (which I believe is the default configuration, for safety reasons). Double click the node and select the run in any thread option.

Also, if you want to ensure running it in its own thread, you can put it in a separate VI and change the execution settings of that VI to run in a different execution system. LabVIEW doesn't give you direct control of threads, because it manages them on its own, but this should make the VI execute in a different thread.

Yair
  • 2,266
  • 12
  • 12
1

Operations with FTP are long-term. It is better to perform such operations in another thread.

fpohtmeh
  • 506
  • 4
  • 15
  • Dll function is executed in main thread too, and you app wait for a long time. Do you ever work with multithreading? Good example here [link](http://stackoverflow.com/questions/12437395/a-simple-example-of-boost-multithreading) – fpohtmeh May 30 '13 at 13:55
  • I never worked with multi threading so I asked for help. Thank you! – LppEdd May 30 '13 at 13:59