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

11 ビュー (過去 30 日間)
Jeffrey D Kelly
Jeffrey D Kelly 2016 年 7 月 28 日
編集済み: Philip Borghesani 2016 年 7 月 28 日
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 件のコメント
Jeffrey D Kelly
Jeffrey D Kelly 2016 年 7 月 28 日
Excellent - thank you - this is very helpful!

サインインしてコメントする。

その他の回答 (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 Center および File ExchangeC Shared Library Integration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by