home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-11 | 1.4 KB | 22 lines | [TEXT/MMCC] |
- // This code was written by François Pottier (pottier@dmi.ens.fr). You can use it freely.
- // Please let me know if you find bugs in it or improve on it.
-
- // Lots of extensions need to install a custom Gestalt selector in order to access their globals. The recommended way to do
- // it is to use Apple's GestaltValue library. It's better because GestaltValue installs a trap whose code is then used by all
- // GestaltValue-aware extensions, thus saving memory.
- // But there is a catch : GestaltValue is only available as a MPW .o file, and when CodeWarrior converts this file into a
- // CodeWarrior library file, it reorders the routines inside it. The GestaltValue are written in such a way that they break
- // when reordered (yech!). Bottom line : we can't use GestaltValue with CodeWarrior.
-
- // By the way, note that all these problems arise only on 68k macs. On a PowerPC writing a custom Gestalt selector is trivial
- // since all fragments have globals automatically.
-
- // The routine below is a replacement for GestaltValue's NewGestaltValue routine. It assumes the presence of the 'GSel' 0
- // resource (which can be built using the Selector.µ project).
- // It works in a simple (and dirty) way : it loads the 'GSel' 0 resource, which contains the selector's code, pokes the desired
- // value into it and then installs it as a Gestalt selector. On a 040 the caches are flushed for safety.
-
- #pragma once
-
- OSErr InstallGestaltValue (OSType signature, long value);
-