• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Dynamic loading of a third party .dylib
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dynamic loading of a third party .dylib


  • Subject: Re: Dynamic loading of a third party .dylib
  • From: "email@hidden" <email@hidden>
  • Date: Sun, 8 Aug 2010 00:22:59 +0100

Thanks Alexander

Your reply prompted me to follow up on calling dlsym().
All is revealed below.

http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryUsageGuidelines.html

Thanks again and sorry for asking this sort of think so late at the weekend!

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com







On 8 Aug 2010, at 00:12, Alexander v. Below wrote:

> I am using a library in a similar fashion (I am loading a jnilib in a Cocoa App), and I am calling dlsym to resolve the individual function addresses.
>
> Alex
>
> Am 08.08.2010 um 00:48 schrieb email@hidden:
>
>>
>> My Cocoa app would very much like to link to a third party dylib.
>>
>> The dylib is created using an external make file and I don't really want to start modifying the build script to change the deployment INSTALL_PATH.
>>
>> I know that I can wield install_name_tool in a build phase but I thought about using dlopen().
>> I know where my dylib is in my bundle so I can target it okay.
>>
>> 1. In Xcode I link to my dylib and mark it as weak.
>> 2. In my app I call dlopen() before accessing any of the library symbols.
>>
>> But the symbol doesn't get resolved.
>>
>> The crash log reports:
>>
>> Dyld Error Message:
>> can't resolve symbol _G__main in /Nuzzle/And/Scratch/MacOS/Contents/boo because dependent dylib #5 could not be loaded
>>
>> Do I have to manually call dlsym() or am I missing a weak attribute somewhere?
>>
>> Or am I just lost in the weeds.
>>
>> some code:
>>
>> 	NSString *dylibPath = [path stringByAppendingPathComponent:@"lib/libCint.dylib"];
>> 	const char *libPath = [dylibPath cStringUsingEncoding:NSUTF8StringEncoding];
>> 	void *dl = dlopen(libPath, RTLD_NOW);
>> 	const char *dlErr = dlerror();
>> 	if (dlErr) {
>> 		NSLog(@"dlerror() =  %s", dlErr);
>> 	} else {
>> 		NSLog(@"dylib path is %s, dl = %p", libPath, dl);
>> 	}
>> 	G__main(0, NULL);	// in libCint.dylib
>>
>> Regards
>>
>> Jonathan Mitchell
>>
>> Developer
>> Mugginsoft LLP
>> http://www.mugginsoft.com
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Xcode-users mailing list      (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Dynamic loading of a third party .dylib [ENLIGHTENED]
      • From: "email@hidden" <email@hidden>
References: 
 >Dynamic loading of a third party .dylib (From: "email@hidden" <email@hidden>)
 >Re: Dynamic loading of a third party .dylib (From: "Alexander v. Below" <email@hidden>)

  • Prev by Date: Re: Dynamic loading of a third party .dylib
  • Next by Date: Re: Dynamic loading of a third party .dylib [ENLIGHTENED]
  • Previous by thread: Re: Dynamic loading of a third party .dylib
  • Next by thread: Re: Dynamic loading of a third party .dylib [ENLIGHTENED]
  • Index(es):
    • Date
    • Thread