0

Is it possible to compile a user-defined subroutine at run-time and pass it as input to another subroutine which has already been compiled in Fortran?

1 Answer 1

1

Short answer: no.

Some languages allow this using some eval() procedure. The Fortran standard doesn't have any such capability, even though one could imagine such an extension if there were some compiler which was using LLVM or similar runtime systems (or even an interpreter).

All Fortran compilers I know are traditional compilers to machine code and they don't allow anything like that. What you could do, is to save the code to a file, call the Fortran compiler in background to compile a shared library (.dll or .so) and then load the library using your operating system specific routines.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.