site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Resent-date: Wed, 8 Jun 2005 17:12:23 -0400 Resent-from: Leon Bottou <leonb@nec-labs.com> Resent-message-id: <200506081712.23634.leonb@nec-labs.com> Resent-to: darwin-dev@lists.apple.com User-agent: KMail/1.8 In Tiger, NSInstallLinkEditErrorHandlers() does not work anymore. Example: ----- begin foo.c extern int bar(int); int foo(int x) { return bar(x); } ----- end foo.c ----- begin bar.c int bar(int x) { return x*x; } ----- end bar.c ----- begin load.c #include <stdlib.h> #include <stdio.h> #include <mach-o/dyld.h> static NSLinkEditErrorHandlers handlers; static void load(const char *bundle) { NSModule module; NSObjectFileImage image; printf("Loading '%s'\n", bundle); if (NSCreateObjectFileImageFromFile(bundle,&image) == NSObjectFileImageSuccess) if (NSLinkModule(image,bundle,NSLINKMODULE_OPTION_BINDNOW)) { printf("Loaded '%s'\n", bundle); return; } printf("Problem loading %s\n", bundle); exit(10); } static void undefined(const char *sname) { printf("Entering undefined handler '%s'\n", sname); load("bar.bundle"); printf("Leaving undefined handler '%s'\n", sname); } int main(void) { handlers.undefined = undefined; NSInstallLinkEditErrorHandlers(&handlers); load("foo.bundle"); } ----- end load.c Compile with: $ cc load.c -o load $ cc -bundle -flat_namespace -undefined suppress bar.c -o bar.bundle $ cc -bundle -flat_namespace -undefined suppress foo.c -o foo.bundle UNDER PANTHER: $ ./load Loading 'foo.bundle' Entering undefined handler '_bar' Loading 'bar.bundle' Loaded 'bar.bundle' Leaving undefined handler '_bar' Loaded 'foo.bundle' UNDER TIGER: $ ./load Loading 'foo.bundle' dyld: NSLinkModule() error dyld: Symbol not found: _bar Referenced from: foo.bundle Expected in: flat namespace Trace/BPT trap CONCLUSION: When running on Tiger, the undefined handler was not called. _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Leon Bottou