Calling python funcion from fortran

723 views
Skip to first unread message

pyman

unread,
Jun 10, 2011, 12:40:01 AM6/10/11
to Fwrap Users
How can I call python function from fortran?

Ondrej Certik

unread,
Jun 10, 2011, 3:20:44 AM6/10/11
to fwrap...@googlegroups.com
On Thu, Jun 9, 2011 at 9:40 PM, pyman <wonjun...@gmail.com> wrote:
> How can I call python function from fortran?

You need to create a C wrapper to it using Cython (see the "public
api" documentation for it), so that you can call it from C.
Then you just call it from Fortran using the iso_c_binding module. I
tried it and it works.

Ondrej

pyman

unread,
Jun 10, 2011, 3:22:25 AM6/10/11
to Fwrap Users
Can you show me your sample?


On Jun 10, 4:20 pm, Ondrej Certik <ond...@certik.cz> wrote:

Ondrej Certik

unread,
Jun 10, 2011, 4:02:24 AM6/10/11
to fwrap...@googlegroups.com
Unfortunately it's not opensource (I would need to get an approval
from my employer).
Ondrej

> --
> You received this message because you are subscribed to the Google Groups "Fwrap Users" group.
> To post to this group, send email to fwrap...@googlegroups.com.
> To unsubscribe from this group, send email to fwrap-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/fwrap-users?hl=en.
>
>

pyman

unread,
Jun 10, 2011, 4:04:36 AM6/10/11
to Fwrap Users
then can you make me some simple example so that I can understand?

Ondrej Certik

unread,
Jun 12, 2011, 3:07:46 PM6/12/11
to fwrap...@googlegroups.com

Wonjun, Choi

unread,
Jun 13, 2011, 12:48:05 AM6/13/11
to Fwrap Users
Thank you for your comment.
but It's hard to make the example according to the web.



On 6월13일, 오전4시07분, Ondrej Certik <ond...@certik.cz> wrote:
> The documentation is here:
>
> http://docs.cython.org/src/userguide/external_C_code.html#using-cytho...
Reply all
Reply to author
Forward
0 new messages