specify compiler used by loadlibrary

2 次查看(过去 30 天)
This Q is for Matlab 2015a on linux. When I call loadlibrary from Matlab command prompt, it generates a "thunk" .so file from an intermediate .c file that loadlibrary must autogenerate then delete after the "thunk" .so file is created. How can I specify the location of the compiler to use to create the "thunk" .so file?
  2 个评论
Philip Borghesani
Philip Borghesani 2015-8-19
I am curious why do you wish to control this on Linux?
Thomas Wilborn
Thomas Wilborn 2015-8-19
Hi Philip,
I have an existing .so library that was compiled using g++ 4.4.5. I loaded it from a Matlab 2015a function "F" using loadlibrary and it worked fine.
Then I compiled the Matlab function "F" using mcc version 2015a and ran it. The compiled code ran fine, but crashed upon exit. Note that 2015a says it is only compatible with code compiled with gcc 4.7.x, so I suspect that is the reason for the crash.
Then I compiled the Matlab function "F" using mcc version 2013a and ran it. The compiled code ran fine and did NOT crash upon exit! Note that 2013a says it is only compatible with code compiled with gcc 4.4.x.
I'd like to use 2015a for my project, but recompiling some legacy .so files using gcc 4.7.x is not feasible. I was hoping that if Matlab 2015a could compile the thunk .so file with 4.4.x, then my existing .so files would be compatible with Matlab 2015a after using mcc 2015a.
Thanks for your help. Let me know if more information would be helpful.
Tom

请先登录,再进行评论。

回答(1 个)

Philip Borghesani
Philip Borghesani 2015-8-19
The compiler used is the one configured/found with mex -setup. This answer may help if you need to modify your configuration: Setup MEX compiler for R2014a for Linux

类别

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