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