[IPython-user] Embedding IPython in C program?
Fernando Perez
fperez at colorado.edu
Fri May 30 13:45:15 CDT 2003
Herb Schilling wrote:
> Hi,
>
> I want to embed IPython in a C program. Here is the C code I am
> using to test this out.
[snip]
>
> What I get as output is the help info ( plus a mysterious IE ) and
> nothing else.. See below for the first part of that output. Am I
> trying to do something that is impossible with IPython ? If it is
> possible, what am I doing wrong ?
It should be possible, but I don't know the details. I'll try to provide as
much info as I can, and maybe we can get somewhere. First, I can't quite get
your code to compile correctly, perhaps someone can give me a hint. I've
never compiled a C code which embeds python, so I'm most likely missing a link
option. Here's what I get (under Linux):
[embed]> gcc -I/usr/include/python2.2 -Xlinker -export-dynamic embed.c
/tmp/ccaaGfYJ.o: In function `main':
/tmp/ccaaGfYJ.o(.text+0x4b): undefined reference to `Py_Initialize'
/tmp/ccaaGfYJ.o(.text+0x5e): undefined reference to `PyRun_SimpleFile'
collect2: ld returned 1 exit status
But that aside, I'm attaching here a few emails from a discussion I had a
while back with another user on this very problem. He found a fix, but I was
reluctant to apply it for reasons stated in the discussion. He said he'd look
into it further, but I never heard back from him. I'll include all of the
background, and if we can sort this cleanly, I'll be happy to include
whichever changes are necessary into ipython's next release.
I hope this is of use to you.
Best,
Fernando.
-------------- next part --------------
An embedded message was scrubbed...
From: unknown sender
Subject: no subject
Date: no date
Size: 3000
Url: http://projects.scipy.org/pipermail/ipython-user/attachments/20030530/d03fee8b/attachment.mht
-------------- next part --------------
An embedded message was scrubbed...
From: Midas Lin <midas at cadence.com>
Subject: Re: a possible fix for embedding IPython in C code
Date: Tue, 11 Feb 2003 12:07:06 -0800
Size: 4211
Url: http://projects.scipy.org/pipermail/ipython-user/attachments/20030530/d03fee8b/attachment-0001.mht
-------------- next part --------------
An embedded message was scrubbed...
From: unknown sender
Subject: no subject
Date: no date
Size: 4728
Url: http://projects.scipy.org/pipermail/ipython-user/attachments/20030530/d03fee8b/attachment-0002.mht
More information about the IPython-user
mailing list