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: Eric Albert <email@hidden>
- Date: Wed, 1 Mar 2006 20:53:43 -0800
On Mar 1, 2006, at 8:39 PM, Jeff DuMonthier wrote:
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.
I'm a bit surprised at that -- I'd expect CFBundle to work fine for
loading C++ code. Do you have a reference for that?
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?
Probably, but I'm afraid I don't remember how. Can you use Xcode 2 and
Tiger? That'll make things easier for you.
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'm pretty sure that's not supposed to be the case, but I might be
thinking of -maltivec rather than -faltivec. I'm sure there's a way to
make this work, since the OS does this all over the place.
-Eric
_______________________________________________
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