Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: detecting "bad" code fragments in OS X...



On Thu, 28 Feb 2002 08:57:56 -0500, Jim Correia <email@hidden>
wrote:
>>> i would like to add a feature on OS X to detect plug-in modules that
>>> cannot be used with our app in OS X; in other words, have the
>>> application detect whether or not a plug-in module has been linked
>>> against InterfaceLib at runtime or something like that and then choose
>>> not to load it. however, since the Carbonized version of our app is not
>>> linked against InterfaceLib, i don't think i can just check for an
>>> InterfaceLib function == "unresolved code fragment symbol" in OS X...?
>
> You *should* be able to just try opening a connection to the plug-in. If
> CFM can't close because InterfaceLib isn't present, you'll get an error,
> and you know you can't load the plug-in. Is this an unacceptable solution?

This is the answer that you're looking for. ;-) Just call GetDiskFragment or
GetSharedLibrary and if it's an InterfaceLib based plug-in then you'll get a
-2804 (cfragNoLibraryErr) error. And if you look in the error string (the
last parameter passed to GDF or GSL) you should see something like
"<InterfaceLib>" as the library that CFM could resolve a connection to.

--
Enjoy,
George Warner,
Mixed Mode Magic Fragment Scientist
Apple Developer Technical Support (DTS)
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.