Does MATLAB compiler require prototype file instead of header file ?

i use loadlibrary command to load 2 files from the SDK. Using it in Code view of App Designer:
loadlibrary('edk.dll','Iedk.h','addheader','IedkErrorCode.h','addheader','IEmoStateDLL.h','addheader','FacialExpressionDetection.h','addheader','MentalCommandDetection.h','addheader','IEmotivProfile.h','addheader','EmotivLicense.h','alias','libIEDK');
loadlibrary('edk.dll','IEmoStateDLL.h', 'alias', 'libIEmoStateDLL');
but when successfully compiled into web app, i got a log error that
Deployed applications must use a prototype file instead of a header file. To create the prototype, use the loadlibrary mfilename option.
After searching the direction, i still have no idea to change the code to prototype file. Do you have any suggestion on this ?

回答 (1 件)

Kojiro Saito
Kojiro Saito 2019 年 12 月 18 日
編集済み: Kojiro Saito 2019 年 12 月 18 日

0 投票

As described in this document, in order to use loadlibrary in deployed application converted by MATLAB Compiler, you need to use with prototype file name (loadlibrary(libname,@protofile)). And in order to create prototype files, you need to add 'mfilename' option to loadlibrary.
In MATLAB Command Window, do the following.
loadlibrary('edk.dll','Iedk.h','addheader','IedkErrorCode.h','addheader','IEmoStateDLL.h','addheader','FacialExpressionDetection.h','addheader','MentalCommandDetection.h','addheader','IEmotivProfile.h','addheader','EmotivLicense.h','alias','libIEDK', 'mfilename','testproto1');
loadlibrary('edk.dll','IEmoStateDLL.h', 'alias', 'libIEmoStateDLL', 'mfilename','testproto2');
Then, testproto1.m and testproto2.m will be created. After that, rewrite loadlibrary from prototype files in your App Designer app,
loadlibrary('edk.dll', @testproto1)
loadlibrary('edk.dll', @testproto2)
So, I suppose these loadlibrary would work in deployed applications.

9 件のコメント

Nhat Khang Truong Khanh
Nhat Khang Truong Khanh 2019 年 12 月 18 日
and after that, i need to include these created m.file into web app, right ?
Kojiro Saito
Kojiro Saito 2019 年 12 月 18 日
Yes, that's right.
Nhat Khang Truong Khanh
Nhat Khang Truong Khanh 2019 年 12 月 18 日
but, now, i cannot find the created .m file. According to the instruction that .m file will be on the current folder, but i didnot see anything thing.
Kojiro Saito
Kojiro Saito 2019 年 12 月 18 日
Do you have a write permission on the current folder?
If yes, can't you find those m files from Windows' File Explorer?
Nhat Khang Truong Khanh
Nhat Khang Truong Khanh 2019 年 12 月 18 日
i dont undersatnd "write permission on the current folder", i think i have not done that yet. Can you show me more ?
Kojiro Saito
Kojiro Saito 2019 年 12 月 18 日
From File Explorer, go to Properties of the folder and confirm your current user account has Write permission.
FolderProperties.png
Nhat Khang Truong Khanh
Nhat Khang Truong Khanh 2019 年 12 月 19 日
編集済み: Nhat Khang Truong Khanh 2019 年 12 月 19 日
i checked it and i had this permission
then, i try
libisloaded('edk.dll')
and the result gives
logical
0
which means fail, i dont understad that even the .m program (which is different with app designer and .m prototype file) in MATLAB runs well.
Also the prototype .m file is not created
Kojiro Saito
Kojiro Saito 2019 年 12 月 19 日
Does loadlibrary with edk.dll works in your MATLAB code before compiling it as standalone application?
Also, edk.dll is not a library created by MATLAB Compiler SDK (Library Compiler)?
I'm asking because loadlibrary has the following limitation.
loadlibrary does not support libraries generated by the MATLAB Compiler SDK™ product.
Pravin Mali
Pravin Mali 2022 年 6 月 2 日
I have a driver which uses ANVNADriver.m as main file and for functioning it uses c libraries .
How to generate a prototype file of ANVNADriver.m
Plz help ! .

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeC Shared Library Integration についてさらに検索

質問済み:

2019 年 12 月 18 日

コメント済み:

2022 年 6 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by