Re: Where to look for dynamic code loading
Re: Where to look for dynamic code loading
- Subject: Re: Where to look for dynamic code loading
- From: Jeff DuMonthier <email@hidden>
- Date: Wed, 1 Mar 2006 23:39:52 -0500
On Mar 1, 2006, at 10:25 PM, Peter O'Gorman wrote:
Look at the docs for CFBundle, dlopen, or NSModule - take your pick. I
think
for applications which already use CoreFoundation CFBundle is your
best bet.
If you don't already use CoreFoundation look at the man pages for
dlopen
and/or NSModule.
I looked at some of CFBundle and it described loading functions and
Objective-C classes, but explicitly said it didn't work for C++
classes. Unless I missed something, that one seems to be out. Can
NSModule be used in non Objective-C code? If not, that one's out too.
I have not looked at dlopen.
If you want to, you can do this just as you'd do it for a universal
binary. Build for two different "architectures" in Xcode -- ppc and
(I think) ppc7400, and I believe the right part of the binary will be
loaded at runtime.
Does XCode 1.5 under 10.3 support something like that?
Another option is to build a single binary, but switch at runtime.
Just give your classes different names and use a factory method to
return the right one based on whether the system supports AltiVec.
This is probably the simpler route if most of your code is
architecture-neutral.
The problem with a single binary is that if you build with the
-faltivec flag the code will crash on G3 machines even if you don't
call any Altivec functions. I could duplicate and rename classes and
set the compile flags on a per file basis, but it seems a lot cleaner
to build the same code in two separate targets with different compiler
flags.
Would I want to build bundles, frameworks or dylibs? I presume I'd
have to copy them into the plugin bundle since I wouldn't want to
install them separately.
_______________________________________________
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