MATLAB Answers

How to create dll in Matlab to be used in Labview

62 views (last 30 days)
Jong-Hwan Kim
Jong-Hwan Kim on 12 Nov 2012
Edited: shubham kumar gupta on 4 Feb 2021 at 21:24
Hi all,
I have problem with converting m-file in Matlab to dll file to be used in Labview. I used MCC to create dll from which Labview cannot find inputs and outputs. And is there any way to convert m-file to be used in Labview except using Matlab node due to its slow calculation speed? Thank you in advance.

  0 Comments

Sign in to comment.

Accepted Answer

Kaustubha Govind
Kaustubha Govind on 12 Nov 2012
Edited: Kaustubha Govind on 12 Nov 2012
I'm not sure exactly what kind of interface LabVIEW requires, but this is how you need to interface with a DLL generated using MATLAB Compiler. Note that you will also need to install the MATLAB Compiler Runtime (MCR) on the machine that the DLL is being deployed upon.
I wonder of what you actually need is a standalone DLL (independent of the MCR) - in that case using MATLAB Coder might be the better option.

  4 Comments

Show 1 older comment
Kaustubha Govind
Kaustubha Govind on 12 Nov 2012
Oops! Yes, indeed. Thanks Fred. I fixed my answer.
Jong-Hwan Kim
Jong-Hwan Kim on 13 Nov 2012
Thank you for your answer. I used MCR and MCC to create dll, finally DLL was successfully created, but Labview still cannot find inputs and outputs. :(
Kaustubha Govind
Kaustubha Govind on 15 Nov 2012
Jong: How does LabVIEW "search" for interface exactly? Does it use the DLL header? Perhaps you might be able to ask NI's Technical Support team?

Sign in to comment.

More Answers (3)

Michael Kaiser
Michael Kaiser on 16 Nov 2012
I'm up against the same issue. I've created both C shared libraries and C++ shared libraries, but cannot use in LabVIEW. How is the MATLAB runtime invoked, initialized?

  0 Comments

Sign in to comment.



shubham kumar gupta
shubham kumar gupta on 4 Feb 2021 at 21:16
Edited: shubham kumar gupta on 4 Feb 2021 at 21:24
GET A DLL FROM MATLAB:
mcc -v -B csharedlib:sumarray sumarray.m
create a scriptWrapper.c,scriptWrapper.h,scriptWrapper.def file[attached]
Now run below
mbuild -v sumarrayWrapper.c sumarray.lib LINKFLAGS="$LINKFLAGS /DLL /DEF:sumarrayWrapper.def" LDEXT=".dll" CMDLINE250="mt -outputresource:$EXE';'2 -manifest $MANIFEST"
now load this new scriptwrapper.dll in labview via import option, and add your old script.dll to this lvlib in labview
Always run loadFunction.vi before using your mainfunction.vi

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by