[Pythonmac-SIG] Macho, socketmodule

Doug Wyatt doug@sonosphere.com
Mon, 8 Jul 2002 00:53:14 -0700


I did a little recreational programming today to see if I could put a 
Cocoa GUI on top of some Python modules I've written.

I've built Python 2.2.1 on MacOSX from the main (non-Mac) distribution, 
with readline/termap enabled because I like them in the interpreter, 
and sockets enabled because PyXML-0.7.1 requires them.

But when I try to link libpython2.2.a into my Cocoa app, I get link 
errors because freeaddrinfo and gai_strerror are multiply defined.  I 
find that socketmodule has some __APPLE__-specific mods to include 
getaddrinfo.c, which defines these symbols, which are also define in 
libSystem.dylib, which Cocoa apps link against.

grepping the source tree, I see that getaddrinfo.c is only used when 
included from socketmodule.c, and in Mac/Distributions/dev.include, 
which I suspect isn't used because I removed the Mac directory, not 
caring about access to the classic Mac toolbox in my Python.

I suspect that making the functions in getaddrinfo.c static would solve 
the problem but wonder if it would break something else ...

Would appreciate tips.

Doug

--
Doug Wyatt
personal:  doug@sonosphere.com   http://www.sonosphere.com

"There is real magic in enthusiasm.
  It spells the difference between mediocrity and accomplishment."
	-- Norman Vincent Peale