f



labview crashing when calling labview-built dll

Hello I need some help with regard to calling a LabVIEW-built DLL in 
LabVIEW.I have created a vi in LabVIEW. I made the DLL for this vi. I 
called this VI as a re-entrant in another vi.This vi(calling DLL) has 
been working fine till yesterday. Since yesterday, it started crashing 
LV.I need some help in this regard.I am attaching the 
screenshots of the Application Builder configuration window, the B.D of the vi 
using DLL and that of the configuration window which pops up when i call the 
DLL.I made a vi which performs FRA. I built its DLL.I have around 10 
inputs. I output 3 one-dimensional arrays, and a string from the DLL.When i 
build the DLL, the builder defines the outputs 'gain', 'phase' and 'frequency' 
as arrays of 8-byte double.When i call this DLL in my vi, the configuration 
window sets them as 'numeric' outputs.Why does this happen? What is the 
solution to this?When i try to set them as 'array' in this configuration 
window, i get a warning that i am trying to change the data types which do not 
match with the data type found in the DLL. Is this the problem with my 
code or with the Application Builder?Now, after i change the 3 output 
datatypes to Arrays, and set their minimum length(i assumed that this value 
means the size of the array ), the vi runs and crashes LV. I am nto sure when it 
crashes, why it crashes. It runs fine at one time. It crashes at another time. I 
am nto sure if these arrays are teh reason why LV crashes. If that is the 
erason, why is it happening only sicne yesterday and not earlier?Also, 
the string output can is a maximum of 412 characters. Will this play a role in 
LV crashing? Kindly someone help me!!I have checked multiple 
times for the data types of the otehr inputs and ouputs. My only doubt is on 
these arrays.I have posted this message <a href="http://forums.ni.com/ni/board/message?board.id=170&amp;message.id=219266&amp;query.id=60082#M219266" target="_blank">here</a>, already. Kindly continue the thread there.


LV error 2.jpg:
http://forums.ni.com/attachments/ni/170/326170/1/LV error 2.jpg


LV DLL.jpg:
http://forums.ni.com/attachments/ni/170/326170/2/LV DLL.jpg


LV DLL _when called.jpg:
http://forums.ni.com/attachments/ni/170/326170/3/LV DLL _when called.jpg
0
x9561 (148440)
5/25/2008 12:40:05 PM
comp.lang.labview 35213 articles. 1 followers. vasusachin24 (1) is leader. Post Follow

13 Replies
1021 Views

Similar Articles

[PageSpeed] 1

LabVIEW version used will be helpfull. I myself also have some trouble with crashes when calling a LabVIEW built DLL. I will dig into this first thing monday morning with my collegue. Maybe we find something in our case that could explain your problem.
0
x9561 (148440)
5/25/2008 2:40:05 PM
Thank you sir! I am using LV 8.2.1
0
x9561 (148440)
5/26/2008 3:40:05 AM
I made a vi which performs FRA. I built its DLL.I have around 10 
inputs. I output 3 one-dimensional arrays, and a string from the DLL.When i 
build the DLL, the builder defines the outputs 'gain', 'phase' and 'frequency' 
as arrays of 8-byte double.When i call this DLL in my vi, the configuration 
window sets them as 'numeric' outputs.The problem is actually here but not as you describe it. The DLL node seems to be configured right since you wire an array of doubles to these three parameters. The problme is about memory allocation.Having the parameter configured as Array data pointer means it is a simple C data pointer and not an LabIVEW array handle. This is good if you ever intend to have this DLL called by some other program than LabVIEW since it is rather hard to make other applications deal right with LabVIEW handles.However for C data pointers the caller is responsible to allocate the memory for these parameters. This means that you can't just wire an empty array constant to the input side of these parameters in the Call Library since this points to a memory aray of 0 bytes length. The function then will attempt to write into that memory area and overwrite memory it is not supposed to overwrite.Replace that array constant with an Array Initialize node that creates an array of sufficient length.Rolf Kalbermatter
0
x9561 (148440)
5/26/2008 7:10:05 AM
Thank you very much sir! I shall try it and get back!!
0
x9561 (148440)
5/26/2008 7:10:06 AM
Sir, I tried using a initialize array function in place of array constant, but in vain.LV is still crashing.Also, what is the difference in using an 'initailize' function and an 'array constant'? I am finally getting a 1-D array.The other doubt i had was : why does the 'call library function node' configuration window detect the outputs 'gain','phase' and 'frequency' as numerics and not arrays?
0
x9561 (148440)
5/26/2008 7:10:07 AM
MScap wrote:Sir,I tried using a initialize array function in place of array constant, but in vain.LV is still crashing.Also, what is the difference in using an 'initailize' function and an 'array constant'? I am finally getting a 1-D array.The other doubt i had was : why does the 'call library function node' configuration window detect the outputs 'gain','phase' and 'frequency' as numerics and not arrays?You do need to make sure to initialize the arrays to the length indicated by your len1, len2, len3 parameters that you also pass to the DLL. An array constant contains only as much elements as you explicitedly enter into it (usually 0, which means it points to a memory area of 0 bytes length). Initialize Array will create a memory block that is large enough to contain the number of elements you specify as length parameter.Rolf KalbermatterMessage Edited by rolfk on 05-26-2008  09:08 AM
0
x9561 (148440)
5/26/2008 7:10:08 AM
Thank you sir! I got the point.I made sure that the no.of elements is same as that of len1,len2 and len3. All these three values are same as the input 'no.of steps'. So, I connected them all together.Now, it runs fine when i pass all the inputs. I have a validation process in my code, which gives an 'error message'(as a string) when any input is not valid ( usually out of data range).LV is crashing, now, only if there are any empty inputs passed to it.When i run the vi without passing any values to the controls, its crashing. Also, its crashing when i enter few inputs and leave others empty. Actually, when no data is passed to the vi, the vi must return a string (of max 412 characters) that the values are not valid.I am gettign this string as the output and then LV is crashing. I am not able to find out the reason.Kindly&nbsp; look into this!
0
x9561 (148440)
5/26/2008 7:40:05 AM
MScap wrote:Thank you sir!I got the point.I made sure that the no.of elements is same as that of len1,len2 and len3. All these three values are same as the input 'no.of steps'. So, I connected them all together.Now, it runs fine when i pass all the inputs. I have a validation process in my code, which gives an 'error message'(as a string) when any input is not valid ( usually out of data range).LV is crashing, now, only if there are any empty inputs passed to it.When i run the vi without passing any values to the controls, its crashing. Also, its crashing when i enter few inputs and leave others empty. Actually, when no data is passed to the vi, the vi must return a string (of max 412 characters) that the values are not valid.I am gettign this string as the output and then LV is crashing. I am not able to find out the reason.Kindly&nbsp; look into this!Same issue probably. When you pass a C data pointer (string or array) you need to make sure to allocate the necessary memory for that parameter in the caller (here your LabVIEW diagram). The DLL has no way of allocating that memory and returning it to the caller.For strings I usually do this by intializing an array of u8 of the necessary size and then using a Byte Array To String function convert it into a string before passing it to the Call Library Node. In LabVIEW 8.2 and higher you also can configure in the Call Library Node a minimum size for array and string parameters. LabVIEW will then make sure to allocate the necessary memory before passing the pointer to the DLL. You can either use an explicit number to allocate a fixed size buffer for statically sized parameters or the name of a different parameter that indicates the number of data elements the array should be resized to.Personally since I still work sometimes in pre 8.2 LabVIEW versions I prefer to do the explicit allocation with Initialize Array myself.Rolf Kalbermatter
0
x9561 (148440)
5/26/2008 8:10:06 AM
Sir, I have made sure that the strings are defined with a minimum length. The array size is connected to an other input(no of steps).As i said earlier, the vi runs fine, without crashing, when all the input parameters are passed. If i do not pass even one parameter, i should get an error message (of max 412 characters). I get this error message and then LV crashes.
0
x9561 (148440)
5/26/2008 8:40:04 AM
Looks like we had the same problem with calling a DLL in LV.Mine was related to a string output of the DLL.Initialise you string output with a string of 412 characters and you're fine.Strings can be intialised in the following way:<img src="http://forums.ni.com/attachments/ni/170/326273/1/Initialise%20string.png"> Message Edited by andre.buurman@carya on 05-26-2008  10:58 AM


Initialise string.png:
http://forums.ni.com/attachments/ni/170/326273/1/Initialise string.png
0
x9561 (148440)
5/26/2008 9:10:09 AM
Thank you so so so very much sir!! We had been worrying over this for a week!!As of now its running fine, without crashing!!:smileyhappy:Thanks again!!
0
x9561 (148440)
5/26/2008 10:10:08 AM
MScap wrote:
Sir,

I have made sure that the strings are defined with a minimum length. The array size is connected to an other input(no of steps).


As i said earlier, the vi runs fine, without crashing, when all the input parameters are passed. If i do not pass even one parameter, i should get an error message (of max 412 characters). I get this error message and then LV crashes.

It's extremely hard to understand what you are exactly doing. Not passing parameters seems like a defnitive error to me but I might misunderstand what you are doing.

Showing your code both how it works and how you try it when it doesn't work would definitly help a lot. Putting up the actual VI with an example of what you try to do would be best.



MScap wrote:
 Thank you so so so very much sir!!

We had been worrying over this for a week!!

As of now its running fine, without crashing!!


<img src="../../i/smilies/16x16_smiley-happy.gif" border="0" height="16" width="16">

 Well I see you got it solved. What I told you in my previous post was in fact the same as what Andre told you later on in a different way.Rolf Kalbermatter
Message Edited by rolfk on 05-26-2008  12:32 PM
0
x9561 (148440)
5/26/2008 10:40:06 AM
Well! I will not be able to post the actual code.I tried with empty parameters because, this DLL will be used in VC++ by someone else.i wanted to make sure that, if the user passes empty paramters, by mistake, the function returns an error. That was the reason, i wanted my vi to run with empty paramters and return the error message.!!anyways!!Thank you both of you for spending your time on my problem!!
0
x9561 (148440)
5/26/2008 10:40:07 AM
Reply:

Similar Artilces:

Calling a LabView DLL from a Labview VI
Hi, I have a vi that is calling a Labview DLL and they both have a same subVI. If I drop that SubVI into the block diagram first then drop in the Call Library Function Node, when I run the VI, the DLL would not work and it did not give me any error. Does anyone know how fix this problem with Labview? or is there some configuration that I can force the all of that SubVI points into the DLL. Thanks for your help, Dan ...

Error 1073 when building LabVIEW app which calls LabVIEW dll
I am trying to use application builder to build an application that calls a dll created in LabVIEW. I get an error referencing a vi within the dll (Parse Stored String(multibyte).vi) saying that "This property is writable or this method is available only when the VI is in edit mode." The only option is to Continue which cancels the build. I had sucessfully built this application prior to including vis that call the dll and the program runs fine in the development environment. Do you have any idea what is causing this and what I cam do about it? I have found a temporary workaround i...

Labview Dll call library function Causing Labview to unload
I am trying to use the Call Library function in Labview 7.1 to call an Init function for a Zathic Can4USB device. When I run the vi, it complete log LabView out of the computer. Can anyone tell me why the function totally unloads LV without displaying an error? &nbsp; Thanks Either the function has a serious bug or you are calling it with invalid parameters or wrongly setup parameters. The problem happening here is that your DLL passes somehow invlid parameters to a system device driver and that driver causes a protection fault. For device driver execeptions which happen in the privileged...

How can I calling LabView DLL within LabView and pass similar Data Types?
--5972977.1071582281832.JavaMail.quiq.tekken Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I am trying to use an Instrument Driver, which is created in LabView6.1 as a DLL. At this point I have only LabView to test this DLL. I was wondering, is there easy way to find out what sort of Parameter or Data Type I should be using. How can I pass the following data with in LabView: LVRefnum as Type? LVBoolean as Type? TD1 (a structure) as Type? It is funny to see that I am able to create a DLL in labview but having trouble calling it within LabView. I th...

build a DLL in LabVIEW &amp; Use the DLL in LabVIEW
I am trying to build a DLL for the simple vi with LabVIEW and want to use the DLL in LabVIEW. is it impossible? &nbsp; I wrote a vi and it have 2 terminals. one is the input for numeric dbl data type and one another is the output for numeric dbl 1D array data type. &nbsp; It was built with the Application builder for LabVIEW 8.0 and DLL was created successfully. &nbsp; I want to use this DLL&nbsp;in new vi with LabVIEW. &nbsp; Call library function used. I wrote a new vi to use that DLL. &nbsp; In config dialog I config each parameter for dll and connected terminals. b...

change a LabVIEW array outside LabVIEW and keep updated in LabVIEW
change a LabVIEW array outside LabVIEW and keep updated in LabVIEW hi, I am Interfacing a FrameGrabber with LabVIEW using a frame grabber SDK(dll). The memory managment of this FG allow you to allocate your own Array and to give a pointer to this Array to the memory manager. Then when you acquire with the frame grabber, the acquired image will be directly accessible in your array. 1.I give to the FG memory manager a pointer to the Labview array through a SDK Dll function. 2. I run the acquisition 3. I display the array My problem is that the Array is allways displayed with it initial val...

LabVIEW crashes when function called from DLL
Hello, &nbsp; I'm a relative new user of LabVIEW and looking for some help. I've posted this issue in another board and was unsuccessful. I was told to try it here. &nbsp; LabVIEW crashes everytime I run it. The code (error.vi) contains a subvi (error2.vi) which calls a function and crashes. The information about the dll file can be found at the following site <a href="http://www.amptek.com/mcadll.zip" target="_blank"> http://www.amptek.com/mcadll.zip</a>&nbsp; . Hope you can help error.vi: http://forums.ni.com/attachments/ni/170/238711/1...

Problem with lsb: LABVIEW.LIB was not called from a LabVIEW process
I've decided to compile the Zero Phase Shift.vi filter into a dll. This vi relies on IIR.lsb and IIR.c files. There is no problems with running the vi itself. However,&nbsp;using&nbsp; a dll that was built&nbsp;from this vi&nbsp;&nbsp;generates a fatal Windows error message &nbsp; LABVIEW.LIB was not called from a LabVIEW process (for example, if one tries to call the dll from within a VB program) &nbsp; If I remove the lsb reference from the vi, then calling the dll has no problems. I have tried to reference the IIR.lsb explicitly from the Build Shared Lib wiza...

Fatal Error
After creating an installaion program, I tried testing the install of my app.&nbsp; The application user interface appears with a Fatal Error dialog box stating LABVIEW.LIB was not called from a LabVIEW process. &nbsp; Other information on this forum regarding a LABVIE.LIB error, usually mention some types of .dll calls, I have no such calls in my application so I'm curious if anyone else has a similar problem and hopefully a solution. &nbsp; Development machine and test install system both XP Pro Using LabVIEW 8.0.1 &nbsp; Thanks in advance. &nbsp; Con &nbsp; &...

Calling cygjpeg6b.dll crashes LabVIEW everytime, no matter...
Calling cygjpeg6b.dll crashes LabVIEW everytime, no matter the chosen settings in Configure. Anyone know why? I am trying to access the DLL cygjpeg6b.dll for fast internal compression and decompression of images int jpegs (without saving to files). I intend to use these compressed images to reduce network use in a code written to pass images from webcams between two linked computers. I do not wish to use the IMAQ functions, hence my interest in this DLL. However, no matter what I set in the Configuration for this DLL call, LabVIEW crashes immediately on clicking OK. Anyone know why? I presume...

Labview 8 crashes when using Read Labview Measurement File
Hi All, &nbsp; I am a new user for Labview. I installed Labview 8.0 from the CD (evaluation copy). I was just testing the sample code provided by NI. I opened the "Load from File and Display" example and I was trying to open the properties for the Read Labview Measurement File component when&nbsp;Labview crashed. I tried it a couple of times and everytime it happens the same way (when I double click the component or right click on it). I am using Windows XP with all the updates done. In the Windows crash report, the application version is 8.0.0.4005. &nbsp; Other problem ...

Labview 7 crashes when opening an earlier Labview version VI
Hello guys. I am using Labview 7 professional edition. The labview crashes when opening an earlier labview version VI. The error message I'm getting is just "Labview has encounted a problem and eneds to close. We are sorry for the inconvenience." The VI contains a few Tag SubVIs, and It is written with an earlier version of Labview(BridgeView is what it was called). Do anyone have any ideas that how I can fix this bug? It's going to be a great help. Thank you very much. Hello, &nbsp; LabVIEW should not be crashing in this situation. Now, does this happen for other simil...

Transfering a struct in a struct form LabVIEW to a dll and get it back to LabVIEW
Hi everyone, &nbsp; actually I've a big problem. I'm calling a dll function through LabVIEW. The called function is defined isw defined as followed: fcbGetEnumFlexCards( fcInfo** pInfo); &nbsp; fcInfo is a struct: typedef struct fcInfo { fcDword FlexCardId; fcVersion Version; fcInfo* pnext; } fcInfo; &nbsp; The Parameter fcDword is an unsigned int 32, but the Parameter Version which is decleared as fcVersion is also a struct: &nbsp; typedef struct fcVersion { fcVersionNumber BaseDll; fcVersionNumber DeviceDriver; fcCCtype CCType; fcDword Reserved[4]; } fcVersion; &a...

LabVIEW
Hi ALL, I am a new user of LabVIEW. I have been assigned to acquire a signal from a sensor at a car. However, all these signals must be filtered. But I am not sure, what type of filter most powerful. Besides, as I know, different type of signal needs differenct type of filter. Anybody can help me to solve my problems. Your kind cooperation is highly appreciated. Regards, M. Firdaus, France Fird wrote: > Hi ALL, > I am a new user of LabVIEW. > I have been assigned to acquire a signal from a sensor at a car. > However, all these signals must be filtered. ...

Debugging a C++ dll from LabVIEW
Hello all, &nbsp; What I want to get a feel for is how easy it is to set up the ability to debug code both in labVIEW AND in a C++&nbsp;compiler, say Visual Studio. &nbsp; If we have a situation where we have a c++ dll which we are accessing from labVIEW is it possible to attach the process so that you can set breakpoints in both environments. Hence run labVIEW app and when dll gets called hit a Visual Studio breakpoint? &nbsp; This is a new area to me and I have not found anything regarding debugging. Any comments would be appreciated. &nbsp; Regards &nbsp; Kevin Hi,...

how to make my labview codings as a package for labview
Hello NI, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I made drivers for some thrid party instruments, which is compatable for serial port and&nbsp;Ethernet.&nbsp;I have several vi's for that i cant able to share these vi's to my friends. i just want to build one package of my driver, also i want to install these package to labview user library. &nbsp; Tell me some good suggestion for this. &nbsp; With&nbsp;warm regards, Balaji DP Application Engineer...

Installation of LabView 8 after LabView 6
Good afternoon everybody, &nbsp; I've got a big problem with LabView. The fact is that I begin with this software... I've just installed LabView 8 on a computer where LabView 6 was installed. Once the installation finished, I tried to launch a VI That was developped under the old version. &nbsp; The problem is that two VI can't be found : - AI Sample Channel.vi - AI Acquire Waveform.vi Therefore, I can't use anymore the program that was working before... What is the solution to get everything ok please ? Thank you very much ! SylvianTriquigneaux, the VI will now...

Call function from dll in labview
Hi All, I have to get data from USB camera, I have following functions in DLL. DLLINOUT=09HANDLE =09WINAPI=09CC_Open( LPCSTR CameraName , ULONG CameraNumber , CC_CAPTURE_MODE CaptureMode ) ; and DLLINOUT BOOL=09 WINAPI=09 CC_CaptureSingle( HANDLE Cam , PVOID Buffer , ULONG TransferSize , CC_TRIGGER_MODE TriggerMode , USHORT TimeOut , OVERLAPPED * pUserOverlapped ); When I open hardware with function cc_open I am getting handle to an object. How can I store this object and pass it to CC_CaptureSingle function? Another question is when I call CC_CaptureSingle I am getting pointer on the 2 ...

Calling a LabVIEW DLL from Delphi
I have created a DLL in LabVIEW 7.1.1 which communicates over seriel line with a tester. This DLL is an interface of a "device driver" which is used in an LV app successfully. This driver is built as Active-X server and DLL. I have created example programs in LV, Visual Basic and Visual C++ single thread and multi threaded. All those examples work fine. For the DLL version I have used the delay load feature of MS Visual Studio. One of my customers is programming in Delphi and he get an error whenever he is starting his application. It seems the error occurs during loading the DLL. He...

Problem about calling a DLL in LABVIEW
Hi, I have a problem using Labview to call a DLL file, when I call the function " commandinterp() in labview, labview will always return error message"an error occured&nbsp;in external code, it might &nbsp;have corrupted labview memory..."&nbsp; attached is the DLL file and the labview code .so did the code i attached&nbsp;have any problem? or is it the problem of the DLL?&nbsp; thanks &nbsp; mydll.txt: http://forums.ni.com/attachments/ni/170/260230/1/mydll.txt callfunctionnode.vi: http://forums.ni.com/attachments/ni/170/260230/2/callfunctionnode.vi ...

How to call Labview DLL from VB2005
Dear all expert, I'm a student and very new in Labview programming. Currently i have build a simple vi and need to convert it to dll so that i can call it from my VB.net. But the problem is how to call the labview dll from my VB.net? &nbsp; I know we must declare function something like this, &nbsp; Auto function Bodeplot Lib"..\\Bodeplot.dll" (Byval Val1 as double, Byval Val2 as double,...) as double &nbsp; but how&nbsp;to determine Val1, Val2 (and so on) is input for which data?&nbsp; if my&nbsp;vi have&nbsp;10 input (frequency, Kc,Fcz,Fcp,Wzrhp,Wp,...

calling LabVIEW dll from C#
Could somebody post a fully working C# example of calling a function from a LabVIEW generated dll with passing strings and integers in and a couple of strings out? What should be settings when creating the dll, of course (which convention, how to pass)? ...

Error Code &quot;1097.....this might corrupted LABVIEW's memory..........&quot; appears after exit the labview and re-start labview
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I have a probelm when I use the "tool/import shared library(.dll)" wizard&nbsp;to generate the&nbsp;API from C. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The API &nbsp;works correctly when I complete the wizard, but after I exit labview and re-start labview to run&nbsp;the API&nbsp;again. The error 1097 code "......this might corrupted LABVIEW's memory.............."appears. &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs...

labview 8.5 to labview 7.0
i am on my labview working with 8.5but at work, we only have labview 7.0.what would be my best way to get my vi to be 7.0?thank you so muchMessage Edited by krispiekream on 06-19-2008 03:59 PM In order to go from LV 8.5 to LV 7, you will need to have LV 8.5 (save it back to 8.0), LV 8.0 (save it back to 7.1) and LV 7.1 (to save back to 7.0). If it's only a few small VI's, you can post them on the forum and ask someone to do the saves for you.&nbsp; (Best if you do the save back to 8.0 and&nbsp;post that in order&nbsp;to eliminate 1 of the 3 steps for whoever will do the r...

Web resources about - labview crashing when calling labview-built dll - comp.lang.labview

Resources last updated: 3/18/2016 2:25:24 PM