1 1.1 mrg 2 1.1 mrg GNU Objective C notes 3 1.1 mrg ********************* 4 1.1 mrg 5 1.1 mrg This document is to explain what has been done, and a little about how 6 1.1 mrg specific features differ from other implementations. The runtime has 7 1.1 mrg been completely rewritten in gcc 2.4. The earlier runtime had several 8 1.1 mrg severe bugs and was rather incomplete. The compiler has had several 9 1.1 mrg new features added as well. 10 1.1 mrg 11 1.1 mrg This is not documentation for Objective C, it is usable to someone 12 1.1 mrg who knows Objective C from somewhere else. 13 1.1 mrg 14 1.1 mrg 15 1.1 mrg Runtime API functions 16 1.1 mrg ===================== 17 1.1 mrg 18 1.1 mrg The runtime is modeled after the NeXT Objective C runtime. That is, 19 1.1 mrg most functions have semantics as it is known from the NeXT. The 20 1.1 mrg names, however, have changed. All runtime API functions have names 21 1.1 mrg of lowercase letters and underscores as opposed to the 22 1.1 mrg `traditional' mixed case names. 23 1.1 mrg The runtime api functions are not documented as of now. 24 1.1 mrg Someone offered to write it, and did it, but we were not allowed to 25 1.1 mrg use it by his university (Very sad story). We have started writing 26 1.1 mrg the documentation over again. This will be announced in appropriate 27 1.1 mrg places when it becomes available. 28 1.1 mrg 29 1.1 mrg 30 1.1 mrg Protocols 31 1.1 mrg ========= 32 1.1 mrg 33 1.1 mrg Protocols are now fully supported. The semantics is exactly as on the 34 1.1 mrg NeXT. There is a flag to specify how protocols should be typechecked 35 1.1 mrg when adopted to classes. The normal typechecker requires that all 36 1.1 mrg methods in a given protocol must be implemented in the class that 37 1.1 mrg adopts it -- it is not enough to inherit them. The flag 38 1.1 mrg `-Wno-protocol' causes it to allow inherited methods, while 39 1.1 mrg `-Wprotocols' is the default which requires them defined. 40 1.1 mrg 41 1.1 mrg 42 1.1 mrg +load 43 1.1 mrg =========== 44 1.1 mrg This method, if defined, is called for each class and category 45 1.1 mrg implementation when the class is loaded into the runtime. This method 46 1.1 mrg is not inherited, and is thus not called for a subclass that doesn't 47 1.1 mrg define it itself. Thus, each +load method is called exactly once by 48 1.1 mrg the runtime. The runtime invocation of this method is thread safe. 49 1.1 mrg 50 1.1 mrg 51 1.1 mrg +initialize 52 1.1 mrg =========== 53 1.1 mrg 54 1.1 mrg This method, if defined, is called before any other instance or class 55 1.1 mrg methods of that particular class. For the GNU runtime, this method is 56 1.1 mrg not inherited, and is thus not called as initializer for a subclass that 57 1.1 mrg doesn't define it itself. Thus, each +initialize method is called exactly 58 1.1 mrg once by the runtime (or never if no methods of that particular class is 59 1.1 mrg never called). It is wise to guard against multiple invocations anyway 60 1.1 mrg to remain portable with the NeXT runtime. The runtime invocation of 61 1.1 mrg this method is thread safe. 62 1.1 mrg 63 1.1 mrg 64 1.1 mrg Passivation/Activation/Typedstreams 65 1.1 mrg =================================== 66 1.1 mrg 67 1.1 mrg This is supported in the style of NeXT TypedStream's. Consult the 68 1.1 mrg headerfile Typedstreams.h for api functions. I (Kresten) have 69 1.1 mrg rewritten it in Objective C, but this implementation is not part of 70 1.1 mrg 2.4, it is available from the GNU Objective C prerelease archive. 71 1.1 mrg There is one difference worth noting concerning objects stored with 72 1.1 mrg objc_write_object_reference (aka NXWriteObjectReference). When these 73 1.1 mrg are read back in, their object is not guaranteed to be available until 74 1.1 mrg the `-awake' method is called in the object that requests that object. 75 1.1 mrg To objc_read_object you must pass a pointer to an id, which is valid 76 1.1 mrg after exit from the function calling it (like e.g. an instance 77 1.1 mrg variable). In general, you should not use objects read in until the 78 1.1 mrg -awake method is called. 79 1.1 mrg 80 1.1 mrg 81 1.1 mrg Acknowledgements 82 1.1 mrg ================ 83 1.1 mrg 84 1.1 mrg The GNU Objective C team: Geoffrey Knauth <gsk (a] marble.com> (manager), 85 1.1 mrg Tom Wood <wood (a] next.com> (compiler) and Kresten Krab Thorup 86 1.1 mrg <krab (a] iesd.auc.dk> (runtime) would like to thank a some people for 87 1.1 mrg participating in the development of the present GNU Objective C. 88 1.1 mrg 89 1.1 mrg Paul Burchard <burchard (a] geom.umn.edu> and Andrew McCallum 90 1.1 mrg <mccallum (a] cs.rochester.edu> has been very helpful debugging the 91 1.1 mrg runtime. Eric Herring <herring (a] iesd.auc.dk> has been very helpful 92 1.1 mrg cleaning up after the documentation-copyright disaster and is now 93 1.1 mrg helping with the new documentation. 94 1.1 mrg 95 1.1 mrg Steve Naroff <snaroff (a] next.com> and Richard Stallman 96 1.1 mrg <rms (a] gnu.ai.mit.edu> has been very helpful with implementation details 97 1.1 mrg in the compiler. 98 1.1 mrg 99 1.1 mrg 100 1.1 mrg Bug Reports 101 1.1 mrg =========== 102 1.1 mrg 103 1.1 mrg Please read the section `Submitting Bugreports' of the gcc manual 104 1.1 mrg before you submit any bugs. 105