Compiling C++ s-functions in MATLAB R2007b x86 on Windows 7 x64 Professional

Steps already taken:
  1. Installed VS 2005 Express
  2. Installed Win 7 SDK
  3. Installed VS 2005 x86 Runtimes SP1 + MFC Security Update
  4. Set the environment variable MSsdk to the SDK path.
  5. Installed Borland 5.5 Compilers
  6. Installed MinGW and Gnumex.
All the compilers will compile a C++ s function successfully. However, when trying to reference those files using an s function block I get an 'error obtaining sizes from Mex. Specified module could not be found'.
Has anyone successfully compiled a C++ s function on the set up described.
I must use 32 bit to be compatible with the work of my colleagues.
- - - - - - - - - - - - - - - - - - - -
Thanks in advance,
Craig

 采纳的回答

The 'Specified module could not be found' error usually means that you are missing one or more DLL dependencies. Please see if this solution helps you debug the issue: How do I profile my EXE or DLL file with Dependency Walker?
PS: The S-function MEX-file is really a DLL with a MEX-specific extension, so you can treat it like a DLL in debugging.

1 个评论

Hello, thanks for your prompt reply.
I typed the following at the command window:
!C:\Work\depends22_x64\depends.exe sfun_cppcount_cpp.cpp
Returning "No DOS or PE signature found. This file is not a valid 32-bit or 64-bit Windows module."
Then I tried
!C:\Work\depends22_x64\depends.exe sfun_cppcount_cpp.mexw32
Returning:
"Error: At least one required implicit or forwarded dependency was not found. Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module. Error: Modules with different CPU types were found. Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module."
I also have error opening file:
  1. LIBGCC_S_DW2-1.DLL
  2. LIBSTDC++-6.DLL
  3. MSVCR80.DLL
My understanding of DLL's etc is pretty poor. I hope you can help me.
Best regards,
Craig

请先登录,再进行评论。

更多回答(1 个)

I think I found a dodgy solution. Please comment on this answer.
I used Windows search to find:
  1. MSVCR80.dll in C:/Windows/winsxs/...
  2. LIBSTDC++-6.dll in C:/Work/MinGW/bin
  3. LIBGCC_S_DW2-1.dll in C:/Work/MinGW/bin
I copied and pasted these to the MATLAB current directory and the model ran successfully.
After recompiling using Visual Studio Express 2005 I only needed to copy and paste MSVCR80.dll into the current directory!

1 个评论

Instead of copying over the DLLs, it might be best to add their actual locations to the system PATH environment variable.

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 C Shared Library Integration 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by