Effacer les filtres
Effacer les filtres

How to change link.exe when compiling mex-file?

2 vues (au cours des 30 derniers jours)
Henri Hämäläinen
Henri Hämäläinen le 30 Sep 2022
Starting point:
I have a makefile that compiles C-source code to object files and also links them and compiles the mex-file. Matlab testbench is used to run the mex-file to test the C-code.
Desired action:
I want to have BullseyeCoverage software integrated to check the test coverage of the C-source files.
Current situation:
The BullseyeCoverage software doesn't recognize the compilations automatically, so I have tried to invoke the Bullseye cl.exe and link.exe in the makefile. The cl.exe I managed to invoke, but the link.exe I cannot. I think what I need to do atleast is change the linker that the mex-compiler uses, but I don't know how. I might be on the wrong trail here altogether, but this is what I have come up with so far.
Any advice on how to achieve the linker change, or preferrably the whole Bullseye integration, would be much appreciated!

Réponse acceptée

Henri Hämäläinen
Henri Hämäläinen le 17 Oct 2022
I found a working solution myself.
Object compilation needs to be done by having both Bullseye\bin and Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64 in PATH, and calling the compiler simply with cl.
Mex file compilation needed two compilation options to be added for the call. So, in the mex compilation call, I just added options COMPILER="cl" and LINKER="covc link".

Plus de réponses (1)

Vijay
Vijay le 14 Oct 2022
ld command is used to link object files together and produce executable. Linker is also part of compiler executable.
Since you are using custom make file you can generate object files first and then you can use ld command to generate final executable.Please make sure ld is available on your PATH.
  1 commentaire
Henri Hämäläinen
Henri Hämäläinen le 17 Oct 2022
Thanks for the answer! Maybe the solution with ld could also have worked. However, I was able to make this work by having Bullseye\bin in my PATH and calling cl.exe in the makefile for both object and mex compilation. And more importantly regarding the link call issue, the mex compilation needed to have two flags added to the command: COMPILER="cl" LINKER="covc link". This way I got the files linked.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Troubleshooting in MATLAB Compiler SDK dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by