- MyLibrary.h
- MyLibrary.dll
- MyLibrary.lib
The procedure entry point ?xxxx@@YAXHAEAVmwarray@AEBV1@ could not be located in the dynamic libarary xxx
69 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
I am receiving the following error when I try to use the DLL file I compiled:
"The procedure entry point ?xxxx@@YAXHAEAVmwarray@AEBV1@ could not be located in the dynamic library xxx"
I am using deployTool GUI to compile my m file
My executable ap calling the compiled DLL is compiled using Visual Studio C++ 2017 (VS 2017. community edition):
>> mbuild -setup
MBUILD configured to use 'Microsoft Visual C++ 2017 (C)' for C language compilation.
The path to Matlab in Windows 10, is set to be
C:\Program Files\MATLAB\R2024a
Since the error message mentions mwarray, do I have to use an extra compilation switch for mbuild in deployTool?
Thank you.
0 Kommentare
Antworten (1)
Aditya Saikumar
am 8 Aug. 2024
Bearbeitet: Aditya Saikumar
am 8 Aug. 2024
Hi Ziarah,
I understand that you are trying to build a C/C++ application in Visual Studio 2017 and are trying to use a function in the DLL file generated by “deploytool”.
The given error occurs when the required LIB files are not included in the project when building. When “deploytool” is used to generate a DLL, additionally a Header (.h) file and a LIB (.lib) file are also generated. The LIB file needs to be included as an additional dependency in the Linker options of the project.
For example, let’s say the library name is “MyLibrary”. The following three files are generated by “deploytool”:
Following are the steps to use “MyLibrary” in a C/C++ project:
1. Add additional include directories:
Project -> Properties -> C/C++ -> General -> Additional Include Directories
Add the following two lines:
C:\Program Files\MATLAB\R2024a\extern\include
path_to_folder_which_contains_MyLibrary.h
2. Add additional dependencies:
Project -> Properties -> Linker -> Input -> Additional Dependencies
Add the following two lines:
C:\Program Files\MATLAB\R2024a\extern\lib\win64\mingw64\mclmcrrt.lib
path_to_MyLibrary.lib
3. Copy MyLibrary.dll to the Target directory of the project
You can either do this manually after building the project or through a Post-Build Event. Steps to use a Post-Build Event:
Project -> Properties -> Build Events -> Post Build Event -> Command Line
Add the following line:
XCOPY "path_to_MyLibrary.dll" "$(TargetDir)" /D /K /Y
Please take a look at the following MATLAB documentation link which has an example of how to use MATLAB generated libraries in Visual Studio:
I hope this helps!
Aditya
0 Kommentare
Siehe auch
Kategorien
Mehr zu C Shared Library Integration 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!