MATLAB Answers

engwindemo.exe - Entry Point Not Found

36 views (last 30 days)
Gary
Gary on 10 Dec 2017
Commented: Gary on 17 Dec 2019
I want to use MATLAB as a COM server, so I was testing the COM interface using engwindemo.c as described in https://www.mathworks.com/matlabcentral/answers/164250-how-can-i-compile-a-matlab-engine-application-using-microsoft-visual-studio-2012
Whilst there are a couple of other compile parameters required if creating engwindemo.exe using Visual Studio 2013 and above, once I compiled engwindemo.exe and ran it, the MATLAB Command Window opens and then I get the following error message:
"The procedure entry point could not be located in the dynamic link library
C:\Program Files\MATLAB\R2017b\bin\win64\libmwms.dll"
(See attached screenshot 2017-12-10 MATLAB engwindemo.exe error).
When I click "OK" to that error message I get a second error message:
"Can't start MATLAB engine"
(see attached screenshot 2017-12-10 engwindemo.exe error (2)).
The error would appear to originate in the "engOpen" command in engwindemo.exe:
/*
* Start the MATLAB engine
*/
if (!(ep = engOpen(NULL))) {
MessageBox((HWND)NULL, (LPSTR)"Can't start MATLAB engine",
(LPSTR) "Engwindemo.c", MB_OK);
exit(-1);
}
I've tried creating engwindemo.exe in Visual Studio 2013, 2015 & 2017, each time I get the same result.
Here is the compilation configuration:
Any help would be greatly appreciated.
Thank you in advance.

  3 Comments

Gary
Gary on 3 Jan 2018
Given that I can't debug the C:\Program Files\MATLAB\R2017b\bin\win64\libmwms.dll object, I figured I would repair/reinstall my Windows 10 and MATLAB R2017b environments back to "pristine" (keeping Apps & Data).
Here is the action plan I followed:
1. Uninstall MATLAB R2017b following instructions https://www.mathworks.com/matlabcentral/answers/101795-how-do-i-uninstall-or-reinstall-matlab-on-a-windows-computer?s_tid=srchtitle
There was no "uninstall.exe" file in the $MATLAB\uninstall folder, so I used the Windows uninstall feature, and deleted the remaining C:\Program Files\MATLAB\R2017b folder and subfolders).
2. Perform a Windows 10 "Repair Install"
As per instructions https://answers.microsoft.com/en-us/windows/forum/windows_10-windows_install-winpc/how-to-perform-a-repair-upgrade-using-the-windows/35160fbe-9352-4e70-9887-f40096ec3085
Using the specifically prepared ISO, and selecting the option to "Keep Apps and Data"
4. Run Windows command (as Administrator) sfc /scannow
This detected NO system file errors.
5. Reboot
6. Download & Install MATLAB R2017b
- Set MATLAB preferences
- Set Windows Environment PATH variable
7. Register MATLAB as COM server (as Administrator)
!matlab -regserver
8. Rebuild engwindemo application using Visual Studio 2013
As per https://www.mathworks.com/matlabcentral/answers/164250-how-can-i-compile-a-matlab-engine-application-using-microsoft-visual-studio-2012
9. Call "engwindemo.exe" to test the COM interface.
I still receive the same error message:
"The procedure entry point could not be located in the dynamic link library
C:\Program Files\MATLAB\R2017b\bin\win64\libmwms.dll"
Is this a bug in R2017b that I should report to Mathworks?
Walter Roberson
Walter Roberson on 3 Jan 2018
To check: is it possible that you are trying to use the engine from a 32 bit executable?
Gary
Gary on 3 Jan 2018
Hi Walter
Good question ...
I checked the VS2013 Configuration Manager and all configurations are x64, (as per the compilation configuration spec above).
(C:\Users\garymarshall\Documents\Visual Studio 2013\Projects\engwindemo\x64\Debug\engwindemo.exe)
Regards Gary

Sign in to comment.

Answers (1)

kuan jiang
kuan jiang on 17 Dec 2019
I also have the same question ,did you figure it out ?

  1 Comment

Gary
Gary on 17 Dec 2019
Kuan,
I reported the problem to Mathworks Technical Support, on 8-Jan-2018 (case #02909721 regarding 'Can't start MATLAB engine') and after a short email exchange with Support agent Zhi Dou, we ended up having a Remote Support Session, which ultimately resolved the issue.
Unfortunately, I did not documentation the solution.
It is almost 2 years ago, and I don't remember the details, (plus I've upgraded regularly since then and never experienced the problem again). So other than suggesting that you contact Technical Support quoting the case reference number above, I'm afraid I can't help you.
I will say, I found the Technical Support Department excellent. They were very responsive, highly knowlegable and solved the problem very quickly. Kudos to them, so I have no hesitation recommending that you use them.
Regards
Gary

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!