coolaid Posted December 2, 2009 Report Share Posted December 2, 2009 Hello there, I have a big problem here. I want to use a bunch of dll created in C#. The dll are used to initialize and read a temperature sensor device. I only have to do the initialization and close my vi to freeze it. Do you know what could cause this? The problem is occurring when I want to stop or close the vi. Any help would be welcome. Thank you, Quote Link to comment
EricLarsen Posted December 3, 2009 Report Share Posted December 3, 2009 Calling Dlls from Labview is a bit of a black art. The most likely cause of the crash is sending the dll a parameter that's different than what it expects. For example, if the dll is expecting a 16 bit integer and you send it a 32 bit integer, Labview probably going to crash. Sounds like that's what's happening to you. Did you write the dll or do you have access to the source code and/or *.h file? If so, double check that you are calling the dlls with the correct parameters. Sometimes in dlls you'll run across complex data stuctures that don't match very well with Labview data types. It that case you usually need to write a wrapper dll that translates the data types into what the dlls expect. Check out this article, it's a starting point for how to call dlls from Labview. It also discusses the difference between calling a regular dll and a .NET assembly. http://digital.ni.com/public.nsf/allkb/DCB90714981A1F148625731E00797C33?OpenDocument Quote Link to comment
coolaid Posted December 7, 2009 Author Report Share Posted December 7, 2009 Calling Dlls from Labview is a bit of a black art. The most likely cause of the crash is sending the dll a parameter that's different than what it expects. For example, if the dll is expecting a 16 bit integer and you send it a 32 bit integer, Labview probably going to crash. Sounds like that's what's happening to you. Did you write the dll or do you have access to the source code and/or *.h file? If so, double check that you are calling the dlls with the correct parameters. Sometimes in dlls you'll run across complex data stuctures that don't match very well with Labview data types. It that case you usually need to write a wrapper dll that translates the data types into what the dlls expect. Check out this article, it's a starting point for how to call dlls from Labview. It also discusses the difference between calling a regular dll and a .NET assembly. http://digital.ni.co...33?OpenDocument Thanks for the hint, but I've check and I mostly call functions from the dll without passing parameters. The problem is that labview can crash only by closing a probe, or with a breakpoint. It's like if the Dll is catching every labview events but don't know how to deal with them even if it's destined to it. Does this talk to you? Thank you, Quote Link to comment
coolaid Posted December 8, 2009 Author Report Share Posted December 8, 2009 Here's an update of my problem. The freezing is not occurring when I run the soft compiled. That's kind of odd. Quote Link to comment
coolaid Posted December 8, 2009 Author Report Share Posted December 8, 2009 Here's an update of my problem. The freezing is not occurring when I run the soft compiled. That's kind of odd. I forgot to tell you that that way I can still debug my application, but it's longer that way. Quote Link to comment
Rolf Kalbermatter Posted December 11, 2009 Report Share Posted December 11, 2009 Sounds like your .Net assemblies are somehow messing badly with some system internals. I know this behaviour form standard DLLs who try to hook themselves into system calls to do some black magic. When trying to unload those DLLs with the FreeLibrary() function, Windows gets confused in some sort of deadlock situation. Seems Microsoft specifically discourages explicit unloading of DLLs on application termination, saying that this can cause dead lock situations for many API calls during such an unload call. Not sure if this applies in your case but the way you describe it it sounds somehow similar. Problem here is that you can not tell LabVIEW not to attempt to unload a .Net assembly when it wants to close down the VI that contains the last .Net Node to that assembly. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.