Target PC unable to load Imagehlp.dll

4 views (last 30 days)
Amaya
Amaya on 28 Jan 2014
Commented: Dimitri MANKOV on 10 Mar 2021
Hi, I am trying to get a complicated Fortran code to run on a PC running the xPCTarget 5.0. I have made a CMEX Wrapper SFunction in the Simulink by compiling my codes using Visual Studio 2008 and Intel Visual Fortran v11.1. I've successfully ran my model in normal mode. I've also ran some simple SFunctions with fortran sunbroutines on the target PC . However, I can't get a more complex Fortran code to successfully run on the target PC. I constantely get "Unable to load dependent module imagehlp.dll error:2 could not load model;corrupted file" messages on the target PC. Using Dependency Walker I've found that my mex32 File loads libifcoremd.dll as a dependency, which in turn loads imagehlp.dll as a dependency. I've tried eliminating the dependency on imagehlp.dll by compiling in Release mode and disabling all debug and tracing options, but imagehlp.dll is still listed as a dependency. I have changed compiling options several times but imagehlp.dll gets loaded anyway. I have compiled my Fortran codes with following flags and options:
set COMPILER=ifort
set COMPFLAGS= /fpp /Qprec /c /nologo /MT /nodebug /real_size:64
set OPTIMFLAGS=-Ox
set NAME_OBJECT=/Fo
rem ******************************************************************
rem Linker parameters
rem ******************************************************************
set LIBLOC=%MATLAB%\extern\lib\win32\microsoft
set LINKER=link
set LINKFLAGS=/dll /export:MEXFUNCTION /LIBPATH:"%LIBLOC%" libmx.lib libmex.lib libmat.lib /implib:"%LIB_NAME%.x" /MAP:"%OUTDIR%%MEX_NAME%%MEX_EXT%.map" /NOLOGO /INCREMENTAL:NO
set LINKOPTIMFLAGS=
set LINK_FILE=
set LINK_LIB=
set NAME_OUTPUT=/out:"%OUTDIR%%MEX_NAME%%MEX_EXT%"
set RSP_FILE_INDICATOR=@
rem ******************************************************************
rem Resource compiler parameters
rem ******************************************************************
set RC_COMPILER=rc /fo "%OUTDIR%mexversion.res"
set RC_LINKER=
set POSTLINK_CMDS=del "%LIB_NAME%.x" "%LIB_NAME%.exp"
set POSTLINK_CMDS1=mt -outputresource:"%OUTDIR%%MEX_NAME%%MEX_EXT%";2 -manifest "%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest"
set POSTLINK_CMDS2=del "%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest"
set POSTLINK_CMDS3=del "%OUTDIR%%MEX_NAME%%MEX_EXT%.map"
and I've used these flag options for compiling my c wrapper along with my Fortran object files:
set COMPILER=cl
set COMPFLAGS=/c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /nodebug
set OPTIMFLAGS=/O2 /Oy-
set NAME_OBJECT=/Fo
rem ****************************************************************** /DNDEBUG
rem Linker parameters
rem ******************************************************************
set LIBLOC=%MATLAB%\extern\lib\win32\microsoft
set LINKER=link
set LINKFLAGS=/dll /export:%ENTRYPOINT% /LIBPATH:"%LIBLOC%" libmx.lib libmex.lib libmat.lib /MACHINE:X86 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /incremental:NO /implib:"%LIB_NAME%.x" /MAP:"%OUTDIR%%MEX_NAME%%MEX_EXT%.map"
set LINKOPTIMFLAGS=
set LINK_FILE=
set LINK_LIB=
set NAME_OUTPUT=/out:"%OUTDIR%%MEX_NAME%%MEX_EXT%"
set RSP_FILE_INDICATOR=@
rem ****************************************************************** rem Resource compiler parameters rem ****************************************************************** set RC_COMPILER=rc /fo "%OUTDIR%mexversion.res"
set RC_LINKER=
set POSTLINK_CMDS=del "%LIB_NAME%.x" "%LIB_NAME%.exp" set POSTLINK_CMDS1=mt -outputresource:"%OUTDIR%%MEX_NAME%%MEX_EXT%;2" -manifest "%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest"
set POSTLINK_CMDS2=del "%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest"
set POSTLINK_CMDS3=del "%OUTDIR%%MEX_NAME%%MEX_EXT%.map"
and in the make command field I've used these libs in addition to my obj. files:
libifcoremt.lib
libmmt.lib
ifconsol.lib
libifport.lib
libirc.lib
svml_disp.lib
  2 Comments
jianshen li
jianshen li on 28 Feb 2021
Have you solved the problem? I had a similar problem
Dimitri MANKOV
Dimitri MANKOV on 10 Mar 2021
I would recommend submitting a ticket to the MathWorks support team.

Sign in to comment.

Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!