How to compile Python scripts for use in FORTRAN?

后端 未结 2 1639
小鲜肉
小鲜肉 2021-01-05 09:43

Although I found many answers and discussions about this question, I am unable to find a solution particular to my situation. Here it is:

I have a main program writt

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-05 09:58

    One way or another, you'll need to get the Python runtime on your server, otherwise it won't be possible to execute Python bytecode. Ignacio is on the right track with suggesting invoking libpython directly, but due to Fortran's parameter-passing conventions, it will be a lot easier for you to write a C wrapper to handle the interface between Fortran and the CPython embedding API.

    Unfortunately, you're doing this the hard way -- it's a lot easier to write a Python program that can call Fortran subroutines than the other way around.

提交回复
热议问题