LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

calling from shared library hangs

Hi,

I have a dll compiled under LV2011 and want to use it inside CVI routines (CVI2010 under Win7)

In general all looks very fine but dialog boxes. Whenever there is a message to be popped up I see only its blank window and a CVI program hangs.

I created a dummy function in this dll with only a dialog box, just to check whether something else doesn't influence this. Works the same, I mean hangs. No text is displayed, just freezed empty dialog window.

 

This dll was running correctly previously, when compiled under LV7.1 and running under CVI2010 under WinXP.

 

Is there any solution for such behaviour??

 

Thanks for help.

0 Kudos
Message 1 of 9
(4,302 Views)

Hi Slawomir,

 

Can you send me please the code you used to reproduce the problem?

I'll take a look on it, and hope we'll find some solution 😉

 

Best Regards,

Tamas

0 Kudos
Message 2 of 9
(4,266 Views)

Hi,

I attached simple CVI environment with compiled dll to be called. There is also problematic vi included.

Please take a look, maybe you can figure out something.

0 Kudos
Message 3 of 9
(4,248 Views)

Hello,

 

I guess this happens because the dll doesn't pass the full information about the user dialogs that are defined by LV 2011.

Why don't you defined the user dialog in CVI? What is it your final goal?

 

Kind regards,

Ion R.

0 Kudos
Message 4 of 9
(4,240 Views)

Hi ion.rosca

what do you mean by:


@ion.rosca wrote:
I guess this happens because the dll doesn't pass the full information about the user dialogs that are defined by LV 2011.


A comment in dialog box is not a result of functions in my dll. Dialogs appear during the execution and impact the further steps.

So obviously I need them be called from LV.

I think however that standard two button dialog box should not be problematic for CVI to be handled.

0 Kudos
Message 5 of 9
(4,230 Views)

When you need to show the LabVIEW UI in a DLL function, it cannot be running in the main thread. In LabVIEW, you would normally set the Call Library Function node to use "Run in any thread" instead of "Run in UI thread". In CVI, or other text based languages, you must spawn a new thread an run the DLL function there. The following code should help you out:

 

int CVICALLBACK ThreadFunction (void *functionData)
{
	 int i=0;
	 i = TestKomentarza(4,"jdksjkdjslk");  
	 return 0;
}

  		

int CVICALLBACK test (int panel, int control, int event,
		void *callbackData, int eventData1, int eventData2)
{
	CmtThreadFunctionID myThread;
	switch (event)
	{
		case EVENT_COMMIT:

			CmtScheduleThreadPoolFunction (DEFAULT_THREAD_POOL_HANDLE,
										   ThreadFunction, NULL, &myThread);   
			break;
	}
	return 0;
}

 

National Instruments
0 Kudos
Message 6 of 9
(4,221 Views)