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

조회 수: 2 (최근 30일)
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

채택된 답변

Kaustubha Govind
Kaustubha Govind 2013년 1월 17일
편집: Kaustubha Govind 2013년 1월 17일
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
Craig
Craig 2013년 1월 18일
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개)

Craig
Craig 2013년 1월 18일
편집: Craig 2013년 1월 18일
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
Kaustubha Govind
Kaustubha Govind 2013년 2월 1일
Instead of copying over the DLLs, it might be best to add their actual locations to the system PATH environment variable.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile 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