Where are the compiled THUNK files located and how to re-use them?

15 次查看(过去 30 天)
Hi All;
I am having trouble locating where the 64-bit THUNK files are located on my Windows 7 laptop when using LOADLIBRARY. The documentation states the default naming convention but not where they reside on my hard-drive.
I am using the default MinGW compiler.
Also, I am interested in knowing how to compile once and then to re-use these THUNK files as the time to re-compile each time LOADLIBRARY is called seems excessive especially given that I have 7 DLL's that are needed to be loaded each time.
Kindest regards, Jeff

采纳的回答

Image Analyst
Image Analyst 2016-7-28
Jeffrey, you have to create the thunk file - it doesn't ship with MATLAB, at least not a custom thunk file for your custom DLL. My attached well-commented file where I had to create one may help you.

更多回答(1 个)

Philip Borghesani
Philip Borghesani 2016-7-28
If you specify the mfilename option to loadlibrary then the thunk file will be created in the same directory as the prototype file and used when the prototype file is used to load the library. By default the thunk file is placed next to the prototype file in a temporary directory created inside tempdir. It is also possible to override the thunkfilename with a second option to loadlibrary.
  2 个评论
Jeffrey D Kelly
Jeffrey D Kelly 2016-7-28
Hi Philip;
Thanks - however I checked my temp directory (%USERPROFILE%\AppData\Local\Temp) and the THUNK DLL is not there.
Also, I am using LOADLIBRARY as follows and I am not using a prototype file but a header file i.e.,
loadlibrary('IMPLserver.dll','IMPLservermatlabinclude.h');
Any thoughts?
Thanks - Jeff
Philip Borghesani
Philip Borghesani 2016-7-28
编辑:Philip Borghesani 2016-7-28
The thunk file is placed in a directory that is named with the tempname MATLAB command. The file generated into the temp directory is deleted when the library is unloaded or MATLAB exits. Specifying mfilename changes the location and prevents it from being cleaned up. If you still want to find it I suggest using process explorer from sysinternals and searching for the dll when you have it loaded into matlab.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 MATLAB Compiler 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by