Using a dictionary to pass data to/from embedded python functions

Alex Martelli aleax at mac.com
Sun Aug 13 12:06:59 EDT 2006


Bill Pursell <bill.pursell at gmail.com> wrote:

> Alex Martelli wrote:
> >
> > I wrote the following file za.c:
> 
> <sample code snipped>
> 
> > and proceeded to compile and execute as follows: [[Note: it does not
> > matter that I'm using 2.5, the code is just as fine with previous
> > versions -- it just happens that 2.5 is what I'm using right now in
> > order to help out with 2.5's beta testing]]:
> >
> > brain:~/pyex alex$ gcc -c za.c -I/usr/local/include/python2.5
> > brain:~/pyex alex$ gcc -o za za.o -L/usr/local/lib/python2.5/config/
> > -lpython2.5
> > brain:~/pyex alex$ ./za
> 
> 
> I needed to include a lot more flags to make the example compile.
> In particular:
> -L /usr/local/lib/python2.4/config/ -lpython2.4 -lrt -lm -ldl -lutil

You no doubt needed that for linking, not for compiling (I needed the -L
and -l too for linking, see above, just not the "other" libraries).


> Why did you not need them?  Is this a misconfiguration on my
> box, or something entirely different?  I've seen this type of thing
> come up a lot, and I can't tell if it is simply the author omitting
> flags for the sake of brevity, or if I'm actually missing something.

Neither: we're just talking about different platforms -- probably both
Unix variants, but with different linking-loader behavior and/or
dependencies among libraries.  Considering that my platform's ld is
doubtlessly the single most prominent difference between it and other
Unix variants from a developer's viewpoint (see
<http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1
/ld.1.html> for more details) I was remiss in not mentioning my
platform; I apologize, I was concentrating on the C++ and Python sources
rather than on the build process (but I should have mentioned it in the
Note, just as I mentioned that I was using 2.5 but it didn't matter!).


Alex



More information about the Python-list mailing list