Ask Your Question
1

Calling a C function with printf from sage

asked 2016-02-22 15:25:01 +0100

kroovy gravatar image

Hi,

I'm trying to run the first example in doc.sagemath.org/html/en/thematic_tutorials/cython_interface.html on SageMathCloud. After creating the necessary hello.c and hello_sage.pyx, I tried running the Cython function in a sage notebook:

%runfile hello_sage.pyx
my_bridge_function()

The problem is that I see the pyx was compiled successfully, but nothing is printed.

I would appreciate any help on how to run the example, or an alternative way to print from a C function that would be visible in the notebook. (I have a more complex C file that I'm trying to run, but it is difficult to debug it without printing)

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-02-24 13:06:44 +0100

Harald Schilly gravatar image

The issue is, that C prints somewhere, where the sagews isn't picking it up. Maybe rewriting print such that it appends to stdout helps?

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-02-22 15:25:01 +0100

Seen: 649 times

Last updated: Feb 24 '16