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

Calling Library within Functions

klopf
Beginner
836 Views

Hello =)

Does anybody know how to call a library from within a function? I'm trying to convert some individual programs into functions for a larger program. When I was running the individual program, a declaration of USE GQRUL_INT and CALL GQRUL (N, QX, QW, ALPHA=ALPHA, BETAW=BETAW) to use the library was working fine. After I converted the program to a function, which is being called from a module in another file, everything to do with that library call is coming up as an error.

The module is able to call other functions without problems. Am I supposed to change that library call in some way?

Thanks!!

Eve

0 Kudos
3 Replies
Vladimir_Koldakov__I
New Contributor III
836 Views

Hello, Eve,

Could you please provide more details?

Is it computational or compiling/linking error? How do you convert the program into function?

-Vladimir

0 Kudos
klopf
Beginner
837 Views
Hello Vladimir,

Sure - sorry for not using enough detail.

Basically, I had been calling the library from within a single file:

PROGRAM INTEG

USE GQRUL_INT
IMPLICIT NONE
.
.
END PROGRAM INTEG

I was able to compile this normally with the library: C:ifort INTEG.f90 %link_FNL%
However, after I changed the program to a function, which is called by the main program through a module file, I get nothing but errors from that library function. I rewrote things to call the library from the main function, but it seems like it would be more efficient to be able to call it from within the function.

FUNCTION INTEG
USE GQRUL_INT
IMPLICIT NONE
.
.
END FUNCTION INTEG

Should I repost this question on the main Fortran forum? I'm not sure if this is a problem with Fortran or with the use of the library. =/

Thanks!!
Eve




Hello, Eve,

Could you please provide more details?

Is it computational or compiling/linking error? How do you convert the program into function?

-Vladimir

0 Kudos
Vladimir_Koldakov__I
New Contributor III
836 Views

Hello Eve,

I have some more questions.

Lets see: you have a program which calls subroutine GQRUL from the library %link_FNL%. The interface GQRUL is described in the module GQRUL_INT. So the module file gqrul_int.mod exists somewhere, maybe in the %INCLUDE% paths.

You converted the program to a function. A function should have a type and should return a value. What is the type of your function? What is the returned value? How do you call your function in the main program?

Then you build your application something like: ifort main_program.f90 INTEG.f90 %link_FNL%. It is not clear from you message when the error comes up. While compiling the program? While executing the program? Could you please provide the error message?

Of course, you can report the problem on another Forum.

Thanks,

Vladimir

0 Kudos
Reply