• 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: "Alexander v. Below" <email@hidden>
  • Date: Sun, 08 Aug 2010 01:12:30 +0200

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
      • From: "email@hidden" <email@hidden>
References: 
 >Dynamic loading of a third party .dylib (From: "email@hidden" <email@hidden>)

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