- Check that the paths provided for the input files (InputTest.dll and InputTest.h) are located in the specified directories and accessible.
- If MATLAB function or the associated header file depends on external libraries, make sure that those libraries are correctly installed and accessible to the compiler.
- Check if the MATLAB Compiler version being used is compatible with the MATLAB version installed on your system. To check the compatibility you may use the "ver" command in the Command Prompt to display the MATLAB version along with all the toolboxes including MATLAB Compiler with their version.
Compile and loadlibrary() issues.
15 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I compile a simple function using this command in the command prompt...
mcc -v -B csharedlib:InputTest InputTest.m
Then, to try to test the library I try to load it in using the load library function...
loadlibrary('InputTest.dll','InputTest.h');
Then, I get a huge amount of errors. Theres thousands of lines of erros but here's an example...
Error using loadlibrary
Building InputTest_thunk_pcwin64 failed. Compiler output is:
C:\ProgramData\MATLAB\SupportPackages\R2021b\3P.instrset\mingw_w64.instrset\bin\gcc -I"C:\Program
Files\MATLAB\R2021b\extern\include" -fexceptions -fno-omit-frame-pointer
-I"C:\Users\User\Desktop\Testing Folder\Matlab dll" -I"C:\Users\User\Desktop\Testing
Folder\Matlab dll" "InputTest_thunk_pcwin64.c" -o "InputTest_thunk_pcwin64.dll" -shared
In file included from C:\Program Files\MATLAB\R2021b\extern\include/mclmcrrt.h:741:0,
from C:\Users\User\Desktop\Testing Folder\Matlab dll/InputTest.h:15,
from InputTest_thunk_pcwin64.c:27:
C:\Program Files\MATLAB\R2021b\extern\include/mclbase.h:23:0: warning: "DLL_EXPORT_SYM" redefined
#define DLL_EXPORT_SYM __attribute__ ((visibility("default")))
Does anybody understand whats going on here?
0 Commenti
Risposte (1)
Maneet Kaur Bagga
il 13 Set 2023
Hi Xymbu,
As per my understanding of the question, the above command is being used to compile a MATLAB function file(InputTest.m) into a shared library named "InputTest" using the MATLAB compiler.
The "loadlibrary" function is being used to load the shared library and its associated header file("InputTest.h"). The command runs successfully depending on the availability of the header file "InputTest.dll" on the path and the correct association of the header file "InputTest.h" with the library.
The error message suggests that there was an issue while building the InputTest_thunk_pcwin64.dll library using the MinGW-w64 compiler. The error message also includes a warning related to the redefinition of DLL_EXPORT_SYM in the mclbase.h file.
Here are some of the troubleshooting steps you can follow to resolve the error:
ver
If none of the above steps work, then there might be more relevant information further down the error log. Review the complete error message to see if there are any additional details or specific errors that can help identify the problem.
Please refer to the following "loadlibrary" documentation for better understanding of the function.
Hope this helps!
Thank You
Maneet Bagga
0 Commenti
Vedere anche
Categorie
Scopri di più su C Shared Library Integration in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!