LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help me port LabWIndows application into LabVIEW

Help me port the LabWIndows application attached, in to a LabVIEW.
0 Kudos
Message 1 of 6
(2,813 Views)
Hi,

You can actually keep your CVI application and just call it from LabVIEW if you build a CVI dll. Then, just use a Call Library Node to call your dll and access your CVI application. Here is a link to a KB that describes how to create a DLL in CVI and call it from LabVIEW. Hope this helps!

Jeremy L.
National Instruments
Jeremy L.
National Instruments
0 Kudos
Message 2 of 6
(2,813 Views)
My CVI application is already calling funtions from a huge dll, so I dont want to create a dll of the main function. I want to port whatever is there in the CVI main function to Lab View, to do that there is one important function call LaunchDSP2350Session which is defined in the dll. When I try to call that function, my Labview software itself crashes. Please look in to the above said function and give me a solution??
0 Kudos
Message 3 of 6
(2,813 Views)
Hi, what error do you receive when you call the DLL? It's important to remember that when calling DLLs in LabVIEW, you must preallocate any necessary memory in LabVIEW to pass to the DLL. For example, if your application returns some data, then you must preallocate enough memory to receive that data from LabVIEW. To do this, you would just initialize an array of data to some size and pass the array into the call library function node. Another problem is complex user defined data types. If you are calling something that has some complex structure, you may be better off creating a wrapper dll in CVI that allows you to call the DLL in LabVIEW using lower level data types, and then the wrapper will combine and form the structure that the actual d
ll wants.

Jeremy L.
National Instruments
Jeremy L.
National Instruments
0 Kudos
Message 4 of 6
(2,813 Views)
The error I get is, " An exception occured within the external code called by a call library node" and then the program crashes.

How to preallocate necessary memory in LabVIEW??
0 Kudos
Message 5 of 6
(2,813 Views)
Preallocating memory is as simple as just wiring a constant or control on the input side of the Call Library Node. What gets tricky is knowing how much memory your need to preallocate. The best way to preallocate a chunk of memory is to initialize a character array with a certain number of elements that you know will me the most that the DLL will need. It's always best to go a little overboard rather than a little under to be sure you get the full message. That error usually refers to the DLL trying to either reallocate or malloc new memory that it doesn't own (i.e., LabVIEW's memory). So, preallocating should fix this. If it doesn't, then there may be something else going on in the DLL and we will need to narrow down the p
roblem to what specific call is causing the error.

Jeremy L.
National Instruments
Jeremy L.
National Instruments
0 Kudos
Message 6 of 6
(2,813 Views)