i tried this by creating a simple .m function(without the need to pass any input parameters and without any output.it just does some calculations and writes time to a file) and built a .net dll from it using matlab compiler.Then i tried to link it in the same way one would for a .net dll ie Net.addAssembly and import.But then when i tried calling the function,it gives error like no static method for class...Please help.I tried asking around but havent received any solution.Is it possible in the first place?
Is it possible to call functions from a DLL that was built in MATLAB? ie possibility of using matlab dll in matlab script itself.
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
sangeet pillai
am 24 Jan. 2017
Beantwortet: sangeet pillai
am 6 Feb. 2017
I am somewhat new to matlab.So i had a question.Incase i have a DLL that was built from a matlab code using 'deploytool'.Now i have used functions from .net dll's that i linked using 'Net.addAssembly' and 'import'.But i wanted to know if it is possible to use the dll's that were built using matlab compiler in MATLAB itself?
One use case for this maybe if someone has written a code and doesnt want to reveal it,then he/she can provide the DLL's to 3rd party.
Akzeptierte Antwort
Benjamin Kraus
am 27 Jan. 2017
Let me propose another solution: Just P-code your MATLAB code using the pcode function and distribute the P-file to the user. If your only goal is to protect your source code, that should be sufficient, and much easier than using the MATLAB Compiler SDK. This will also eliminate any need for the user to install the MATLAB Runtime.
The MATLAB Compiler SDK is really meant for making your code available outside MATLAB, using it to obfuscate your code isn't really what it was meant for.
Weitere Antworten (2)
Benjamin Kraus
am 24 Jan. 2017
Bearbeitet: Benjamin Kraus
am 24 Jan. 2017
I think what you need to do is to write a MEX function wrapper around your new DLL. MEX functions are the interface that allows MATLAB to call C/C++ code.
Basically, write a C/C++ function named "mexFunction", with a signature as described in that doc page. Within your C/C++ function import the DLL and call the DLL like you would in any other C/C++ code.
2 Kommentare
Benjamin Kraus
am 27 Jan. 2017
If you don't plan to use your DLL outside MATLAB than the MATLAB Compiler SDK is not really the best tool for the job, and any attempt to get it working will be kind of a hack. Based on your description, it sounds like you just want to pcode your function.
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!