From: C. Minnella on 13 May 2005 12:11 I am experiencing some odd behavior when I call a dll in my LabVIEW vi. Big pictures is this: I am creating a program in LV which will serve as the user interface for a piece of software written in Matlab. We are exporting the Matlab functions to a dll which will be called repeatedly from my vi. We have overcome the hurdle of speaking with the Matlab dll by creating a set of c dll's which convert mxArray datatypes. This all seems to be working well so far. The problem is that LabVIEW crashes when the Matlab dll is first called if I haven't manually selected the dll in the Configure pane of the Call Library Function node. I have a very simple test vi which I've experimented on. The vi just calls Initialize and Terminate functions from the Matlab dll in a sequence structure. These functions have no inputs or outputs Here are my observations:<br>1) start LabVIEW, load vi and run = crash<br>2) start LabVIEW, configure either Call Library Funtion node and browse for the dll, Okay, Save, Run = no problem, repeated runs work perfectly<br>3) perform step 2, close vi and reopen (leaving LabVIEW open), run works perfectly<br>4) repeat step 1 = crash<br><br>Since I can't programmatically Configure a Call Library Function node, I can't think of way to make a reliable vi. Any suggestions?<br><br>Chris
From: C. Minnella on 24 May 2005 10:41 Well, I must have confused myself with that "solution" because it doesn't really work. As described previously, my top level vi calls two subvi's, one that intializes the matlab dll, and one that terminates it. Here are some further observations:<br><br>If the Top Level VI is in the same directory with the matlab dll (and it's 90+ friends) the vi will run without incident. However, I would like to avoid having my top level vi sitting there with all those dlls, so I am experimenting with moving it around.<br><br>If the top level vi is in another directory and LabVIEW is launched and the vi run, crash. BUT, if I open LabVIEW, and select browse on a path control and select the directory (or a file in the directory) that contains the dlls, then run, no problem. This is actually what was occurring in my first post, but I didin't realize it. It is not necessary to configure the Call Library Function nodes; all that needs to be done is somehow change the Working Directory to the directory containing the dlls. Unfortunately, I can't figure out how to do this programmatically. I've tried playing with System Exec, but the Working Directory doesn't keep after the call is completed. I've also tried opening a file from the directory, but this doesn't seem to change the WD at all.<br><br>Any thoughts or insights would be appreciated. I'd like to know what actually happens behind the scenes when a file/directory is selected from the dialog. This problem seems to be localized to handling dlls generated from Matlab because so many external dlls are required to be called dynamically.<br><br>Thanks,<br>Chris
|
Pages: 1 Prev: A dynamic link library (DLL) initialization routine failed Next: PID-Regler |