필터 지우기
필터 지우기

DLL creation to use in LabVIEW

조회 수: 11 (최근 30일)
Filipe
Filipe 2011년 6월 20일
댓글: David Roohy 2020년 9월 8일
Hello,
I found one thread you've answered related with DLL creation from Matlab code and its usage in LabVIEW.
I'm trying to do it but until the moment I've not been successful, so, could you please help me with this?
I'm using "deploytool" in Matlab to generate the DLL but afterwards I do not know how to use it in LabVIEW. Could you please help me with this?
Thank you very much in advance.
Best regards, Filipe

답변 (3개)

Kaustubha Govind
Kaustubha Govind 2011년 6월 20일
You might have better luck getting specific help on NI forums.
However, for general guidance using MATLAB Compiler generated DLLs in an application, please see C Shared Library Target. I also found help on the NI website on How Do I Call a Dynamic Link Library (DLL) from LabVIEW?
Hopefully you should be able to deduce the required information from these two resources.

Ashish Uthama
Ashish Uthama 2011년 6월 20일
I believe LabVIEW can be viewed as the 'applications which loads a dll as a plugin' in this solution.
The trick is to wrap the MATLAB DLL in another layer to perform the MCR initialization part. The above solution has some example code you could look at.
  댓글 수: 3
Ashish Uthama
Ashish Uthama 2011년 6월 20일
The wrapper code has logic to initialize once and reuse. The link appears to hint that the DLL is not unloaded by default unless one does additional steps.
It would be best to hook into these phases if possible, the wrapper code is not the easiest to follow/adapt.
Seng Vongsachang
Seng Vongsachang 2015년 11월 5일
Can someone please package a simple m function, create dll, write wrapper, and integrate into LV in a zip file if this has been successfully demonstrated.

댓글을 달려면 로그인하십시오.


David Roohy
David Roohy 2019년 1월 16일
  댓글 수: 4
Mohammad Reza Ramezani
Mohammad Reza Ramezani 2020년 9월 6일
Hi.
I've downloaded your work and followed it step by step but I've failed to compile the example Warpper.c that I wrote using your exact command (I'm using matlab2020) it says something about the "WinMain" function and I cant go furthermore.
anyway, I've skipped 3 and 4 sections and by using your actual .dll files I've created a .lvlib file but there is a broken arrow that says "The library specified for this node cannot be found or cannot be loaded". I've added exampleScript.dll to my directory and double-checked everything that you mentioned in your procedure but I still receiving that message. (I'm using the 2020 version of LabVIEW)
David Roohy
David Roohy 2020년 9월 8일
Hi Mohammad,
I don't have access to MATLAB 2020 or LabVIEW 2020 currently to try to reproduce. We eventually found the interoperability between MATLAB and LabVIEW such a complex interrelationship to maintain that we abandoned trying to call MATLAB in-process from LabVIEW. We now implement much of the math in LabVIEW and simply produce some plots in MATLAB afterwards through a call to a web service.
If LabVIEW says that it cannot load the DLL, then the DLL or one of its dependencies must be missing. The issue may even be related to the "WinMain" function error that your compliler complained about initially. I'm really not an expert here, but WinMain is the main entry point to all Windows applications programmed in C. If there's a problem with loading that function, then I can't expect you'd get very far. I would google the specific compilation error you received in MATLAB and then escalate to MATLAB support from there if your search doesn't give you any conclusive answers. Unless you get a functioning DLL that you can successfully build and call in MATLAB, I wouldn't expect you to be able to do the same in any other programming environment.
David

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by