[Pythonmac-SIG] dynload_darwin.c

Steven Majewski sdm7g@Virginia.EDU
Wed, 30 Jan 2002 18:05:33 -0500 (EST)


  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

---2138096204-1389522796-1012431933=:297
Content-Type: TEXT/PLAIN; charset=US-ASCII



Ok. It looks like the significant difference between the dlcompat
dlopen and my dynload code is that both link using the PRIVATE
option, but dlopen uses an interface to a  non-public function
NSMakePrivateModulePublic. This two step process is done to keep
from getting the duplicate symbol error.

Here's a version which steals the interface definition from
dlcompat/dlopen.c, and add that call.

This seem to work for me. Right now there are warning messages
printed for duplicate symbols, but the linking and symbol
resolution continues without raising an exception to Python.


Could some of the folks who are having problems give this one a
try ? It's named dynload_darwin.c because we'll probably change
it and the config files for the next release. You need to
rename it dynload_next.c and stick it in Python-2.2/Python to
replace the old dynload_next.c

 I hope this is finally the one!n

-- Steve


---2138096204-1389522796-1012431933=:297
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="dynload_darwin.c"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.OSX.4.43.0201301805330.297@d-128-61-180.bootp.virginia.edu>
Content-Description: 
Content-Disposition: attachment; filename="dynload_darwin.c"

DQovKiBTdXBwb3J0IGZvciBkeW5hbWljIGxvYWRpbmcgb2YgZXh0ZW5zaW9u
IG1vZHVsZXMgKi8NCg0KI2luY2x1ZGUgIlB5dGhvbi5oIg0KI2luY2x1ZGUg
ImltcG9ydGRsLmgiDQoNCiNpbmNsdWRlIDxtYWNoLW8vZHlsZC5oPg0KDQoj
ZGVmaW5lIERFQlVHIDENCg0KLyogUHJpdmF0ZSA9IDAgZm9yIG5vcm1hbCBi
ZWhhdmlvdXIgKGdsb2JhbCBzeW1ib2xzKQ0KICogICAgICAgICAgIE5TTElO
S01PRFVMRV9PUFRJT05fUFJJVkFURSB0byBrZWVwIHN5bWJvbHMgcHJpdmF0
ZQ0KICovDQojZGVmaW5l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