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