Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7177 Discussions

?jacobi Fortran: fcn must be declared external?

Stijn_Schildermans
214 Views

According to the documentation for the Fortran version of ?jacobi the fcn argument must be declared as external:

https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-fortran/2025-0/jacobi.html

 

I want to avoid doing this because In my case fcn is a simple wrapper around a call to a module procedure which relies on internal state and declaring it as external would mess up the program structure more than I like. I tried compiling and running without declaring fcn as external (right now it is a subroutine I declare within the procedure calling djacobi). This seems to work without issue.

I would assume that if there is an issue with linking, I will get a linking error or a catastrophic runtime error. Since I do not get either of those, I would assume omitting the external keyword is fine in my case? Nevertheless, I am making this post to double check if I may be unknowingly creating unsafe behavior in this way and what exactly the reasoning is behind requiring a procedure to be declared as external as the documentation currently does. 

 

0 Kudos
1 Reply
Fengrui
Moderator
42 Views

Declaring the user-provided function as external is to pass it as an argument of djacobi. I also tried to declare it explicitly in an interface block. It works expected for the in-package example. I will report it to the team as a documentation issue. Thank you for pointing it out!

0 Kudos
Reply