In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Dan Kogai) wrote:
> As you see ${ldflags} is injected into $lddlflags but in case of > -prebind we need to avoid that. $ldflags is for perl linking while > $lddlflags is for XS. Since -prebind and -bundle are mutually > exclusive, we do not want -prebind in $lddlflags (though CC on darwin > is smart enough to ignore -prebind when -bundle, it still issues > warnings and I don't want to see that warning for each XS gets built). Another question is whether to use something other than bundle for XS, to allow prebinding. I have a patch to dl_dyld.xs that seems to work; it allows both bundle and dyld (thanks to some pointers from wsanchez). --- dl_dyld.xs.orig Wed Jun 4 06:57:32 2003 +++ dl_dyld.xs.new Wed Jun 4 06:57:21 2003 @@ -109,14 +109,22 @@ NSModule handle = NULL; dyld_result = NSCreateObjectFileImageFromFile(path, &ofile); - if (dyld_result != NSObjectFileImageSuccess) - TranslateError(path, OFImage, dyld_result); - else + if (dyld_result == NSObjectFileImageSuccess) { // NSLinkModule will cause the run to abort on any link error's // not very friendly but the error recovery functionality is limited. handle = NSLinkModule(ofile, path, TRUE); NSDestroyObjectFileImage(ofile); + } + else if ((dyld_result == NSObjectFileImageFormat || + dyld_result == NSObjectFileImageInappropriateFile) && + NSAddLibrary(path) == TRUE) + { + handle = (NSModule)(void *)-1; + } + else + { + TranslateError(path, OFImage, dyld_result); } return handle; Then, instead of using -bundle, I used -dynamiclib. However, when I tried to add -prebind I got a bunch of errors, and then I ran out of time to mess with it. :-) But perhaps worth: 1. doublechecking my work :) 2. including it in perl's DynaLoader as an option for XS developers, even if -bundle is still the default -- Chris Nandor [EMAIL PROTECTED] http://pudge.net/ Open Source Development Network [EMAIL PROTECTED] http://osdn.com/