site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:from:date :x-google-sender-auth:message-id:subject:to:content-type :content-transfer-encoding; bh=xSsARihk8tlmCXN4HS8S9dYM9zVkU9h9EiZPny65l0U=; b=BbGGHcjmLxidS8U6OB4D/iwKtYc6REykac1ssM6sQS0A85jzyd+McUM4ZwiPG/yd6A wf4iLQSCi8qHshnAA4zkrmonf0lxplr+gTZ9nWtAEt5BXQWbfYMiohI6wFiunE7Ombrr MtAbeuEAKFzw04UxceSHNFgxe+Io1vkTM9/ks= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:from:date:x-google-sender-auth:message-id :subject:to:content-type:content-transfer-encoding; b=EntW2V+mgQ9HEy0fHu+YZTG9vGORt2gSI63nPnCWc6wqbBxLNVEH1f73bKZ9syvLfo 3Satp/b2yFR4BwbKrTXEo6EzPZDzjhkG3J4S0+m33G3jWSDs5/DYR01m5wxsLhGokzWf oGyRj8HJRUmlQSLMCZy3+ea52yw7qbo+009lI= Heya, I'm loading a framework whose path isn't known until after my executable launches. I'm weak linking against the framework, and its exported functions are marked as weak_import. After loading the framework with dlopen() (or simply -[NSBundle load]), I can call objective-c methods in the framework fine. The trouble comes when I try and call its C functions, where it starts descending into dyld_stub_ craziness, followed by a crash : Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x00000000 #0 0x00000000 in ?? () #1 0x000031dd in main (argc=1, argv=0xbffff2f8) at /Users/jon/Developer/encoder/encodermain.m:151 I can look up the functions one at a time using dlsym(), and assign them to local function pointers, and calling those then works ok, but obviously calling the original framework function still crashes. eg - if my framework exports "void FooBar();" : void (*myFooBar)(); myFooBar = dlsym(framework, "FooBar"); myFooBar(); // works fine FooBar(); // Crashes with dyld craziness Is there any way of replacing all references to FooBar in my executable with the newly looked up symbol address, or am I stuck with only being able to call through to the framework via local function pointers? Or is there a better way of accomplishing this? -Jonathan _______________________________________________ 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