From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dll, matlab an LadVIEW

Hello,
 
I have now run your code and it crashed LabVIEW 7.1 twice in two attempts.  It also crashes LabVIEW 8.0.  I am not sure what's wrong.  I also could not get good debug information from visual studio.  I will file a corrective action request to R&D to see if this can be addressed, but the only relevant error I get indicates and unhandled exception, which tells me that something goes wrong in the dll, the exception is passed up to LabVIEW, and LabVIEW cannot handle it.
 
I'll repost with any useful information, but I'm not optimistic about this one since there may not be a lot we can do if the exception is truly occuring in the dll.  Why it is occuring there is something I think only the authors of the dll or the environment used to create it can answer.
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
0 Kudos
Message 21 of 86
(5,054 Views)

Hi,

In matlab it is possible to create a dll with debug information. I didn't use it before because I didn't know what to do with it, but maybe you will get a more specific error.

Thank you very much for trying!

 

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
0 Kudos
Message 22 of 86
(5,050 Views)
Hello again,
 
No luck debugging with the new versions of those files - I see the same information in the visual studio debugger:
 
Disassembly: (just a 5 line sample, but it's all the same)
00000000 ???
00000001 ???
00000002 ???
00000003 ???
00000004 ???
 
The call stack is just:
> 00000000() 
I'm not an expert, but I don't think that info would help even an expert figure out specifically what's causing the crash.  It was a long shot, but at least we tried!
 
Best regards, and sorry it seems like we won't be able to defeat this one 😞
 
JLS
Best,
JLS
Sixclear
0 Kudos
Message 23 of 86
(5,041 Views)
I've been watching this thread off and on as new things come up. I apologize if I mention something that's already been said, but I thought I'd throw out my two cents. I don't work the MATLAB end of things, but I am often called upon to include MATLAB dll's into LabVIEW code, so here's my experience:

1) as of MATLAB R14, there is a MATLAB Run-time that should be installed on machines running ML compiled software. I see that you sent a zip of dll's to try (the zip was about 530k). I would be incredibly surprised if that actually contained all the necessary dll's. In my experience, when a ML compiled dll can't find something it wants, LV goes down in a hurry.

2) it's worth compiling the ML code to an executable, and trying it from the command line to make sure it runs first.

3) judicious application of printf's in your ML code can help track down exactly where in the dll the error is occurring.

As far as this goes, I always need to troubleshoot a dozen things to get a bit of ML code working in LV. Maybe it's supposed to be easy, but it isn't. Hope this helps!
Chris
0 Kudos
Message 24 of 86
(5,028 Views)

Hi,

I succeeded in using a matlab 7.0 dll in labview 7.1. After it worked, there was a second problem - it would onlly run once. there is another thread in this forum that offers some solutions, but they didn't work for me, so I used another solution - I split the function into three functions: an initialize function, the calulation function and the terminate function, and I call the terminate only after I have finished all the calculations.

All the files are attached, along with a word document called 'dll README' that explains step by step how the files were created. The matlab dll is called libmatrix.dll. The C++ dll is called dllexample.dll. The labview vi is called dllexample.vi. If you have any questions , I will do my best to answer. Suggestions are also welcome.

good luck and thanks to everyone for all the help

Danielle

Note: For the files to run you need to have the MCR installed on your computer.

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
0 Kudos
Message 25 of 86
(4,923 Views)
Danielle,

Could you please post a sample VI to go with the libmatrix.dll you posted?

thanks
-abs
0 Kudos
Message 26 of 86
(4,783 Views)

Hi,

There is a labview vi in the debug folder called dllexample.vi.

If you need an additional vi, let me know.

Good luck!

 

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
0 Kudos
Message 27 of 86
(4,776 Views)
I don't know how I missed that.
Thanks!
0 Kudos
Message 28 of 86
(4,773 Views)

Danielle,

I'd like to test-drive your solution, but I don't have the matlab run-time (I guess it's called MCRInstaller.exe)? Doesn't seem like Mathworks.com offers it for download. Would you mind posting yours here or emailing it to me (yzadorozhny@optellios.com)? I believe it is license-free.

Thanks a bunch!

Zador

0 Kudos
Message 29 of 86
(4,659 Views)
Hi,
 
I tried to run your program, but it does not work - some dlls seems to missing. But can you actually give me a clou how to write the needed wrapper file -
so that matlab and labview can communicate??? Maybe you can give me a example of such a wrapper file??
 
nice greetings,
Alex
0 Kudos
Message 30 of 86
(4,634 Views)