MATLAB Answers

0

engOpen hangs up when calling from dll

Asked by Thomas Stubbs on 23 Jul 2019
Latest activity Answered by Thomas Stubbs on 26 Aug 2019 at 13:46
I am using COM services to interface with MATLAB from my project. For my startup project I am able to call engOpen and it returns an engine. However, I created a plugin for my application that compiles into a dll. Whenever I attempt to call engOpen from this library, the process hangs up and just sits there at the same memory usage and goes to 0 cpu usage.

  0 Comments

Sign in to comment.

Tags

1 Answer

Answer by Thomas Stubbs on 26 Aug 2019 at 13:46
 Accepted Answer

The problem was calling engOpen while loading the library or creating a COM thread in the DllMain. This goes against the best practices suggested here - https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-best-practices. I called engOpen from a method that wasn't statically initialized using GetProcAddress and it worked fine.

  0 Comments

Sign in to comment.