11-03-2006 03:27 PM
11-06-2006
11:08 AM
- last edited on
07-17-2024
02:28 PM
by
Content Cleaner
Don,
The documentation you link to is primarily geared at building a dll to call from LabVIEW in an external IDE (such as Visual Studio).
You may want to look at this example to see how to call the dll you created in LabVIEW:
https://www.ni.com/docs/en-US/bundle/labview/page/example-1-call-a-shared-library-that-you-built.htm...
In short, all you need to do is place a "Call Library Function Node" on your block diagram and then double click on it to bring up it's configuration dialog. Within the configuration dialog you can point it to your dll and select the function you want (typically it will be the name of your dll) at which point LabVIEW should automatically populate the parameters tab.
Give it a try and if you run into any trouble let us know and we'll be happy to help.
Regards,
Simon H
Applications Engineer
National Instruments
11-07-2006 02:26 PM
11-08-2006 02:35 PM
11-09-2006 07:40 AM
11-10-2006 09:35 AM
11-13-2006 01:22 PM - edited 11-13-2006 01:22 PM
Message Edited by Simon H on 11-13-2006 01:22 PM
11-14-2006 09:32 AM
I stared and stared without seeing that. Sometimes you just need a second set of eyes which is why I post here when I have problems. Will let you know when I get it running. Thanks again.
Sincerely,
Don
11-14-2006
12:54 PM
- last edited on
07-17-2024
02:28 PM
by
Content Cleaner
Well I guess we are not going to get off that easy.
To test the code, I went back to the beginning and first made sure the LabVIEW source (prior to building DLL) was running correctly which it was (PCA_test.vi). I then built the DLL from the PCA.vi (same as PCA_test.vi but with necessary controls to successfully build the DLL), and took the values that validated the source code and made them into constants for the input parameters to be fed into the built DLL to perform the analagous fx in the test VI (test_labview_created_dll.vi). The latter VI containing the DLL runs without error, but hangs forever. It should run rather quickly as the LabVIEW source runs in a few seconds or less. I checked to make sure that the constants are of the correct type (I actually just popped up on DLL terminals to form constants).
I then deleted what I thought was any suspect code such deallocation of memory, references, local variables, etc. and repeated with the same result (hanging).
Since I have included a sample set of images as constants in the code, it is somewhat large and not really attachable, so I have put it on your ftp site. The name of it is test_labview_created_dll.zip. Any insight you can provide would be greatly appreciated as this is critical to validate this code library.
Sincerely,
Don
11-15-2006
09:51 PM
- last edited on
07-17-2024
02:31 PM
by
Content Cleaner
Don,
I think the reason your DLL is hanging is that it is attempting to run in the UI thread along with the calling VI and this is causing a deadlock (see the last bullet on the first linked page).
Here are some other links that I think you might find useful for debugging purposes if you haven't already found them.
Why Does LabVIEW Crash When I Call My DLL?
Debugging DLLs and Calls to DLLs
Integrating LabVIEW Code into Other Programming Languages
I also found this old post regarding a similar situation.
Another tip that may help you is that PCA.h in your PCA folder contains the type definitions and function prototype required to call the DLL from C. This makes interfacing with text based code a little easier.
I hope this helps.
~Simon