필터 지우기
필터 지우기

Cannot debug Fortran dll in Visual Studio

조회 수: 7 (최근 30일)
Rami Abboud
Rami Abboud 2021년 12월 15일
답변: Divyanshu 2024년 3월 4일
I have a simple Fortran dll compiled with Intel Fortran Compiler using Visual Studio 2019 IDE. I use a script to load the dll library containing the subroutine and then call that function as such:
program.m
n = 3;
A = rand(n, n);
B = zeros(n, n);
loadlibrary('x64\Debug\CopyArray.dll')
[A2, B2] = calllib('CopyArray', 'CopyArray', A, B, n);
The script executes normally and returns the correct output to Matlab. However, I cannot seem to debug the .dll in order to see what is happening inside the Fortran subroutine. I perform the following steps in order to try to debug the .dll in Visual Studio IDE:
  1. I first use "attach to process" to Matlab executable.
  2. I then place a breakpoint somewhere inside the Fortran subroutine.
  3. I run program.m from Matlab
When doing so, the program is executed without stepping into the Fortran subroutine. Am I missing something ?
Thank you in advance for your help!

답변 (1개)

Divyanshu
Divyanshu 2024년 3월 4일
Hi Rami,
You can refer the following MATLAB Answer thread, which talks about debugging a function inside C/C++ shared library loaded using 'loadlibrary' function.
However, it is specific for C/C++ and not sure if the same would work for 'Fortran' or not, you can refer the steps mentioned in the answer. Here is the link:
Hope it helps!

카테고리

Help CenterFile Exchange에서 Fortran with MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by