From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI DLL target project needs to let caller update progress

I'm still thinking about this old topic of mine

 

If I ever get around to packaging my low-level project into a DLL, other host projects that use it won't necessarily be CVI.  So my DLL can't have upward CVI dependencies to let the caller know status of DLL function looping.

 

I've looked briefly into multithreading with pointers, but it seems to me that this would be machine/processor dependent.  I can't really use PostDeferredCall because of the CVI dependencies back up in the caller.

 

Should I simply increment an index in my loop and output that from the function by reference?  Something like this:

 

int DLLSTDCALL myFunction (int* progress)
{
	double stuff;
	
	// worker loop
	for (int i=0; i<1000; i++)
	{
		stuff = rand();
		
		*progress = i;
	}
	
	return;
}

 

And then just leave it up to the framework caller to handle the progress pointer in a multi-threaded fashion?

0 Kudos
Message 1 of 2
(4,034 Views)

meh, it'll all work out.

 

I did some testing with multi-threading and it works pretty well to get visibility of real-time status.

 

I decided to leave it up to the client platform to deal with threads on their own if they want this visibility of a DLL function.

0 Kudos
Message 2 of 2
(4,016 Views)