Re: Executing non objective-c code in a loaded bundle
Re: Executing non objective-c code in a loaded bundle
- Subject: Re: Executing non objective-c code in a loaded bundle
- From: Uli Kusterer <email@hidden>
- Date: Wed, 28 Jun 2006 23:59:35 +0200
Am 28.06.2006 um 22:23 schrieb Pascal Pochet:
make an URL from the POSIX path to your bundle
CFURLRef bundleURL = CFURLCreateWithFileSystemPath
(CFAllocatorGetDefault(),
ABSOLUTE_PATH_TO_YOUR_BUNDLE_AS_CFSTRINGREF,
kCFURLPOSIXPathStyle, NO) ;
BTW -- CFURLRef and NSURL* are toll-free bridged, so if you have an
NSURL*, you can just cast it to a CFURLRef. Same applies to
CFStringRef and NSString*.
to call the function:
(*FUNCTION_VAR)( PARAMS );
BTW - C lets you get away without dereferencing FUNCTION_VAR. So,
if you want to, you can write
FUNCTION_VAR( ... );
and thus call a dynamically loaded function just like a static one
if you put its pointer in a global or "file-global" static variable.
Useful if you have a library that gets loaded when it is present, but
without which you can do (like Growl, for instance, or a library to
talk to some hardware that's only there if that additional hardware
is installed). You can write the code without all those additional
asterisks and brackets.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden