Part 1 - Part 2 - Part 3
comp.lang.objective-c FAQ, part 1/3: Answers
From: tiggr@es.ele.tue.nl (Pieter J. Schoenmakers)
Newsgroups: comp.lang.objective-c,comp.answers,news.answers
Subject: comp.lang.objective-c FAQ, part 1/3: Answers
Supersedes: <answers_861361127@es.ele.tue.nl>
Followup-To: comp.lang.objective-c
Date: 20 May 1997 07:19:44 GMT
Organization: Eindhoven University of Technology, the Netherlands
Expires: 29 Jun 1997 07:19:43 GMT
Message-ID: <answers_864112783@es.ele.tue.nl>
Reply-To: tiggr@ics.ele.tue.nl
Summary: This first part of the comp.lang.objective-c FAQ postings
tries to answer all your Objective-C questions.
Archive-name: Objective-C/answers
Version: $Id: answers,v 3.41 1997/05/14 23:24:16 tiggr Exp $
Answers to
FREQUENTLY ASKED QUESTIONS
concerning Objective-C
This is the first in a series of three informational postings concerning
comp.lang.objective-c. This first part answers FAQs; the second part lists
available class libraries and the third part is a simple sample Objective-C
program.
This posting answers the following questions:
1 What is Objective-C?
2 What is the difference between Objective-C and C++?
2a What is the difference between Objective-C and Java?
3 What exactly is it that makes Objective-C have `classes similar to
Smalltalk', and what are the resulting capabilities of Objective-C?
4 What are the `nice features' of Objective-C?
5 What are some of the common problems of the language and how can I work
around them?
6 What object encapsulation does Objective-C provide?
7 What are Protocols?
8 How can garbage collection be applied to Objective-C?
9 What is the difference between the NeXTSTEP, Stepstone and GNU CC
versions of Objective-C?
10 How do I debug Objective-C using a non-NeXT gdb?
11 I get this `Floating exception'...
12 Why am I lectured by gcc about `#import'?
13 Did NeXT buy Stepstone? [NO!]
14 What written information concerning Objective-C is available?
15 What kind of Objective-C support is provided by Stepstone?
16 What kind of Objective-C support is provided by NeXT?
17 What kind of Objective-C support is provided by GNU?
18 Is Objective-C supported on <my favourite platform>?
19 What are the newsgroups to read or mailing lists to subscribe to in order
to stay up-to-date on developments for GNU Objective-C?
20 Are there any FTP sites with Objective C code? Where?
21 If there any information on the Net concerning Objective-C?
22 For more information...
(To find a question search on the question number starting a line.)
1 What is Objective-C?
Objective-C is an object oriented computer programming language. It is
a superset of ANSI C and provides classes and message passing similar to
Smalltalk.
Objective-C includes, when compared to C, a few more keywords and
constructs, a short description of which follows. For a complete example
of the application of the constructs, see part 3 of this FAQ.
`@interface' declares a new class. It indicates the name of the class,
the name of its superclass, the protocols adhered to (see Q7), the
layout of the instance variables (similar to the definition of a struct,
but including encapsulation information (see Q6)) and declares the
methods implemented by this class. A class' interface usually resides
in a file called `<classname>.h'.
`@implementation' defines a class. The implementation is no more than a
collection of method definitions. Without an implementation, a class
does not exist at run time. The implementation of a class usually
resides in a file called `<classname>.m'.
A `@category' is a named collection of method definitions which are
added to an existing class. With the NeXT runtime, a category can
redefine existing methods. However, with the GNU runtime, a category
can not do so.
Objective-C includes the predefined type `id' which stands for a pointer
to some object. Thus, `id obj;' declares a pointer to an object. The
actual class of the object being pointed to is almost irrelevant, since
Objective-C does run-time type checking.
`-message;' declares a method called `message'. The `-' indicates that
the message can be sent to objects. A `+' instead indicates the message
can be sent to class objects. A method is similar to a function in that
it has arguments and a return value. The default return type is `id'.
If a method has nothing useful to return, it returns `self', which is a
pointer to the object to which the message was sent (similar to `this'
in C++).
[obj message], [obj message: arg1] and [obj message: arg1 with: arg2]
are examples of sending a message to the object OBJ with 0, 1 and 2
arguments respectively. The name of the message is called the selector.
In this example, the selectors are: `message', `message:' and
`message:with:', respectively.
2 What is the difference between Objective-C and C++?
C++ follows the Simula 67 school of OO programming, where Objective-C
follows the Smalltalk school. In C++ an object's static type as
perceived by the sender of a message determines which method will
actually be invoked; this is static binding. In Smalltalk the actual
type of the object at run time determines the method, i.e. binding is
dynamic. As a result, in Smalltalk objects are not even statically
typed; (in Objective-C static typing is optional). The Simula 67
school is safer, since static typing is mandatory and more errors are
detected at compile time. The Smalltalk school is more flexible, as
some valid programs will execute correctly in Smalltalk, where they
would be rejected by Simula 67.
Stepstone's Objective-C allows you to choose between the dynamic and
static binding, GNU and NeXT do not. ANSI C++ allows you to use dynamic
binding, but discourages you from doing so.
In many ways, the difference between C++ and Objective-C is more a
question of mind set than technical barriers. Are you willing to offer
some flexibility for some safety? Advocates for the Simula 67 school
claims that a well designed program doesn't need the extra flexibility
(a lie), while advocates for the Smalltalk school claims that the
errors are no problem in practice (another lie). The truth lies
somewhere in the middle, with contemporary Objective-C programming
practices employing dynamic binding (mandatory) and static typing.
Pragmatic differences between Objective-C and C++ include:
C++ has operator overloading. Some consider this to be `syntactic
sugar', and it is, but it can be a quite handy bit of sugar.
C++ has multiple inheritance. There are several ways to `get
around' this in Objective-C (see below).
The added syntax and semantics of C++ is huge, while Objective-C is
C plus just a small number of new features.
2a What is the difference between Objective-C and Java?
The most obvious difference, apart from all the applet hype, is
syntax: Java's syntax is based on C++ syntax whereas Objective-C
employs the C syntax (and semantics) with object declaration and
manipulation based on Smalltalk.
The most basic difference between Java and Objective-C is that they
employ exactly the same object model. (Nested classes do not change
that since they are retrofitted on the original Java 1.0 object model
for compatibility with 1.0 tools.) In fact, Java objects are much
more Objective-C with a different syntax, than they are C++.
Other differences include mandatory typing, more extensive thread
support, security managers, name spaces, predefined classes (java.lang,
the AWT, etc), etc.
3 What exactly is it that makes Objective-C have `classes similar to
Smalltalk', and what are the resulting capabilities of Objective-C?
Objective-C is as close to Smalltalk as a compiled language allows:
* Much of the syntax, i.e. Smalltalk uses method names like
`a:method:name:', as does Objective-C. In Objective-C, the message
sending construct is enclosed in square brackets, like this:
`[anObject aMessage: arg]' whereas Smalltalk uses something like
`anObject aMessage: arg'.
* The basic class hierarchy, that is, having class `Object' in the very
top, and letting most (all) other classes inherit from it.
* Objective-C has class objects and meta classes mostly like Smalltalk.
* You can add or delete methods and classes at runtime. (On GNU and
NeXT one can load new classes and categories. On Stepstone, which
lacks categories, the only way to add methods is to load a subclass
which then does a `+poseAs:' of the class to have methods added.
This is less flexible, but it sort-of does the trick of just adding
methods.)
* Most method names in the Object class are the same like, for example,
`respondsTo:'. What is called `doesNotUnderstand:' in Smalltalk
is called `doesNotRecognize:' in Objective-C.
* Smalltalk normally uses `doesNotUnderstand:' to implement
forwarding, delegation, proxies, etc. In [GNU, NeXT] Objective-C,
such functionality is implemented by `forward::'.
* Objective-C does not have class variables like Smalltalk, but pool
variables and globals are easily emulated via static variables.
* Objective-C is compiled---Smalltalk is only partially compiled. The
current Objective-C implementations are all *much* faster than any
Smalltalk. For example ParcPlace Smalltalk-80/4 is at least 3 times
slower than both the GNU and NeXT Objective-C's. (This was measured
using the Self/Smalltalk benchmark suite available by FTP from
`self.stanford.edu:pub/Self-2.0.1'.)
The big difference of course is that Objective-C does hybrid typing:
one can choose to represent a string as a `char *' or as an object,
whereas in Smalltalk, everything is an object. This is a reason for
Objective-C being faster. On the other hand, if every bit of
information in an Objective-C program would be represented by an
object, the program would probably run at a speed comparable to
Smalltalk and it would suffer from not having optimizations
performed on the basic classes, like Smalltalk can do.
4 What are the `nice features' of Objective-C?
The possibility to load class definitions and method definitions
(which extend a class) at run time.
Objects are dynamically typed: Full type information (name and type
information of methods and instance variables and type information
of method arguments) is available at run time. A prime example of
application of this feature is `-loadNibSection:owner:' method of
NeXTSTEP's Application class.
Persistence [...].
Remote objects [...].
Delegation and target/action protocols [...].
5 What are some of the common problems of the language and how can I work
around them?
There are some `common problems':
There is no innate multiple inheritance (of course some see this as
a benefit).
To get around it you can create a compound class, i.e. a class
with instance variables that are ids of other objects.
Instances can specifically redirect messages to any combination
of the objects they are compounded of. (It isn't *that* much of
a hassle and you have direct control over the inheritance
logistics.) [Of course, this is not `getting around the problem
of not having multiple inheritance', but just modeling your
world slightly different in such a way that you don't need
multiple inheritance.]
Protocols address the absence of multiple inheritance (MI) to
some extent: Technically, protocols are equivalent to MI for
purely "abstract" classes (see the answer on `Protocols' below).
[How does Delegation fit in here? Delegation is extending a
class' functionality in a way anticipated by the designer of
that class, without the need for subclassing. One can, of
course, be the delegate of several objects of different
classes. ]
There are no class variables.
You can get around this by defining a static variable in the
implementation file, and defining access methods for it. This
is actually a more desirable way of designing a class hierarchy,
because subclasses shouldn't access superclass storage (this
would cause the subclass to break if the superclass was
reimplemented), and allows the subclass to override the storage
(if the classes access all their own variables via methods).
[The question remains what the exact syntax of class variables
should be: Should a class object A be seen as an instance of its
meta-class MA, which has a super class MB being the meta-class
of A's super, B, and, as such, should A have separate instances
of class variables defined for B? Or not?]
6 What object encapsulation does Objective-C provide?
Object encapsulation can be discerned at two levels: encapsulation of
instance variables and of methods. In Objective-C, the two are quite
different.
Instance variables:
The keywords @public, @private and @protected are provided to secure
instance variables from prying eyes to some extent.
@public anyone can access any instance variable.
@protected only methods belonging to this object's
class or a subclass thereof have access to
the instance variables.
@private only methods of this class may access the
instance variables. This excludes methods
of a subclass.
If not explicitly set, all instance variables are @protected.
Note: Instance variable encapsulation is enforced at compile-time.
At run-time, full typing information on all instance variables is
available, which sort-of makes all variables @public again. This
information is for instance used to do instance variable lookup by
NeXTSTEP's `loadNibSection:owner:' method, making it completely
safe.
Methods:
To the Objective-C runtime, all methods are @public. The programmer
can only show his/her intention of making specific methods not
public by not advertising them in the class' interface. In
addition, so-called private methods can be put in a category with a
special name, like `secret' or `private'.
However, these tricks do not help much if the method is declared
elsewhere, unless one reverts to indicating the object's type at
compile time. And the runtime doesn't care about all this and any
programmer can easily circumvent the tricks described. Thus, all
methods really are always @public.
7 What are Protocols?
Protocols are an addition to Objective-C that allows you to organize
related methods into groups that form high-level behaviors. Protocols
are currently available in NeXTSTEP (since 3.0) and GCC (since 2.4).
Protocols address the MI issue. When you design an object with multiple
inheritance, you usually don't want *all* the features of both A and B,
you want feature set X from A and feature set Y from B. If those
features are methods, then encapsulating X and Y in protocols allows you
to say exactly what you want in your new object. Furthermore, if
someone changes objects A or B, that doesn't break your protocols or
your new object. This does not address the question of new instance
variables from A or B, only methods.
Protocols allow you to get type-checking features without sacrificing
dynamic binding. You can say "any object which implements the messages
in Protocol Foo is OK for this use", which is usually what you want -
you're constraining the functionality, not the implementation or the
inheritance.
Protocols give library builders a tool to identify sets of standard
protocols, independent of the class hierarchy. Protocols provide
language support for the reuse of design, whereas classes support the
reuse of code. Well designed protocols can help users of an application
framework when learning or designing new classes. Here is a simple
protocol definition for archiving objects:
@protocol Archiving
-read: (Stream *) stream;
-write: (Stream *) stream;
@end
Once defined, protocols can be referenced in a class interface as
follows:
/* MyClass inherits from Object and conforms to the
Archiving protocol. */
@interface MyClass: Object <Archiving>
@end
Unlike copying methods to/from other class interfaces, any incompatible
change made to the protocol will immediately be recognized by the
compiler (the next time the class is compiled). Protocols also provide
better type checking without compromising the flexibility of untyped,
dynamically bound objects.
MyClass *obj1 = [MyClass new];
// OK: obj1 conforms to the Archiving protocol.
id <Archiving> obj2 = obj1;
// Error: obj1 does not conform to the TargetAction protocol.
id <TargetAction> obj3 = obj1;
Another use of protocols is that you can declare an ID to conform to
some protocol in order to help the compiler to resolve method name
conflicts:
@interface Foo: Object
-(int) type;
@end
@protocol Bar
-(const char *) type;
@end
-blah1: d
{
id t = [d someMethod];
do_something_with ([t type]);
}
-blah2: d
{
id <Bar> t = [d someMethod];
do_something_with ([t type]);
}
In this example, there are two kinds of the `-type' method. In the
method `-blah1:', the compiler doesn't know what return type to expect
from `[t type]', since it has seen both declarations of `-type'. In
method `-blah2:', it knows that `t' conforms to the `Bar' protocol and
thus that `t' implements the `-type' method returning a `const char *'.
8 How can garbage collection be applied to Objective-C?
Currently, there are two implementations of garbage collection which can
be used in Objective-C programs [that I'm aware of]. Both methods use a
radically different approach.
Garbage Collection in an Uncooperative Environment
This implements garbage collection of chunks of memory obtained
through (its replacement of) malloc(3). It works for C, C++,
Objective-C, etc.
@article{bw88,
title="Garbage Collection in an Uncooperative Environment",
author="Hans J\"urgen Boehm and Mark Weiser",
journal="Software Practice and Experience",
pages=807-820,volume=18,number=9,month=sep,year=1988}
It is available as `ftp://parcftp.xerox.com/pub/gc/gc4.3.tar.gz'.
Garbage Collection through Class Abstraction
This implements garbage collection through class abstraction
(and hence is Objective-C specific). Anything to be garbage
collectible must be an object (instance of a subclass of a
specific class) or have such an object for a wrapper.
Available as `ftp://ftp.ics.ele.tue.nl/pub/tiggr/tl.tar.gz'
Apart from the obvious radical difference, another difference currently
is also noteworthy: The first method automatically protects objects
pointed to from the stack, bss or data segments; the second doesn't.
9 What is the difference between the NeXTSTEP, Stepstone and GNU CC
versions of Objective-C?
NeXT extended Stepstone's definition of the language to include new
constructs, such as protocols, which are touted to deal with some
aspects of multiple inheritance.
Stepstone supports static _binding_, whereas NeXTSTEP and GNU CC don't.
All implementations do support static _typing_.
Stepstone has a standard set of Foundation class libraries that work
across all supported machines, including NeXTSTEP. NEXTSTEP comes with
its own set of libraries (called `kits'). GNU libobjc.a currently only
includes the `Object' class, though people are busy on a Real library
(see part two of this FAQ (The ClassWare Listing) for details).
The `Object' class of all implementations differ.
NeXTSTEP and GNU CC support Categories, Stepstone doesn't.
NeXT has a native language debugger (which is a modified gdb);
Stepstone doesn't; for GNU, patches are available to turn gdb 4.16
into an Objective-C aware debugger.
NeXTSTEP (from version 3.0) and GCC (from version 2.4) support protocols
and forward declarations of classes, Stepstone currently does not.
10 How do I debug Objective-C using a non-NeXT gdb.
On August 20 1996, Michael Snyder of NeXT posted patches to GDB 4.16
to make it Objective-C aware for GNU Objective-C code, at least tested
on HP-UX, Solaris and MS Windows. As he did not supply a net.address
for these patches, I've made them available as
ftp://ftp.ics.ele.tue.nl/pub/objc/gdb-gnu-objc.diff.gz.uue, accompanied
by ftp://ftp.ics.ele.tue.nl/pub/objc/gdb-gnu-objc.README.
Debugging Objective-C using a non-Objective-C aware gdb has been
documented by Martin Cracauer <cracauer@wavehh.hanse.de> on
http://www.cons.org/cracauer/objc-hint-gdb.html. (It comes down to
understanding that you can very well look at Objective-C from the C
perspective, a language very well understood by gdb.)
11 I get this `Floating exception'...
Then you're running Linux and adding `-lieee' to the linker invocation
could help. Thomas March <amadeus@bga.com> reported that on several
occasions, on systems running Linux ELF, with libc.so.5.0.9 and
libm.so.5.?.?, the problem was reproducible and adding `-lieee' did not
solve the problem. However, switching to a newer libc (libc.so.5.2.18
and libm.so.5.0.5) both solved the problem and removed the need for
`-lieee' (i.e. a back to normal situation).
If the problem you're having does not fit either description given, ask.
12 Why am I lectured by gcc about `#import'?
GNU CC issues the following multi-line warning about the how the use
of `#import' is discouraged (output from GNU CC 2.7.0):
foo.m:1: warning: using `#import' is not recommended
The fact that a certain header file need not be processed more than once
should be indicated in the header file, not where it is used.
The best way to do this is with a conditional of this form:
#ifndef _FOO_H_INCLUDED
#define _FOO_H_INCLUDED
... <real contents of file> ...
#endif /* Not _FOO_H_INCLUDED */
Then users can use `#include' any number of times.
GNU C automatically avoids processing the file more than once
when it is equipped with such a conditional.
In short, use `-Wno-import' as an argument to gcc to stop it from
producing this. Another possibility is to compile gcc after having
changed the line reading `static int warn_import = 1' into `static
int warn_import = 0' in `cccp.c' (line 467 in GNU CC 2.7.1); this way,
`-Wno-import' is the default setting.
Whether or not using `#import' is desirable (obviously) has to do with
how to prevent multiple inclusions of the same file. Most include
files, when included multiple times, either do nothing new (possibly
due to guards being used) or (without the guards) cause the emission
of C code on which the compiler will choke (due to, for instance,
repeated typedefs). Thus, if everybody were to use `#import'
everybody would be happy, since it does not seem to matter. However,
a notable exception to this rule is `assert.h', which changes the
definition of the `assert' macro depending on the setting of the
NDEBUG macro.
There is one point to be made in favour of the warning: if the _user_
of an include file uses `#include' instead of `#import', the guards
will be necessary. Thus, actually, the warning should be issued when
a file is imported that appears not to be guarded.
Apart from the more-or-less religious (and thus useless) debate
whether `#import' or `#include'-with-guards is better, it has been
observed that `#import' does not catch re-reading a linked and/or
duplicated file, whereas the guards do. However, this is, of course,
a highly unlikely and probably undesirable situation for which neither
was designed to catch.
The reason for the existence of `#import' probably is historical: the
first implementation of Objective-C (by Stepstone) was as a preprocessor
to C, run after a modified cpp. `#import' was the include-once
directive to that cpp. Since it is part of the Objective-C language, it
has made it into GNU CC's cpp.
13 Did NeXT buy Stepstone?
No they didn't!
NeXT did acquire all rights previously owned by Stepstone to the
Objective-C trademark and Objective-C language. More information on
`http://www.next.com/AboutNeXT/PressKit/PressReleases/1995/stepstone.040495.html'.
14 What written information concerning Objective-C is available?
Books on Objective-C, or object oriented programming in general:
Brad J. Cox, Andrew J. Novobilski: Object Oriented Programming: An
Evolutionary Approach. Addison-Wesley Publishing Company, Reading,
Massachusetts, 1991. ISBN: 0-201-54834-8 (Japanese: 4-8101-8046-8).
abstract: The first book on Objective-C, which actually is a
book on object oriented system development using
Objective-C.
Lewis J. Pinson, Richard S. Wiener: Objective-C: Object Oriented
Programming Techniques. Addison-Wesley Publishing Company, Reading,
Massachusetts, 1991. ISBN 0-201-50828-1 (Japanese: 4-8101-8054-9).
abstract: Includes many examples, discusses both Stepstone's
and NeXT's versions of Objective-C, and the
differences between the two.
Timothy Budd: An Introduction to Object-Oriented Programming.
Addison-Wesley Publishing Company, Reading, Massachusetts.
ISBN 0-201-54709-0 (Japanese: 4-8101-8048-4).
abstract: An intro to the topic of OOP, as well as a comparison
of C++, Objective-C, Smalltalk, and Object Pascal
Simson L. Garfinkel, Michael K. Mahoney: NeXTSTEP Programming Step
ONE: Object-Oriented Applications. TELOS/Springer-Verlag, 1993
(tel: (800)SPR-INGE).
abstract: It's updated to discuss NeXTSTEP 3.0 features
(Project Builder, new development environment)
but doesn't discuss 3DKit or DBKit.
NeXTSTEP Object Oriented Programming and the Objective C Language.
Addison-Wesley Publishing Company, Reading, Massachusetts, 1993.
ISBN 0-201-63251-9 (Japanese: 4-7952-9636-7). This is also
available on the World Wide Web at
http://www.next.com/Pubs/Documents/OPENSTEP/ObjectiveC/objctoc.htm.
abstract: This book describes the Objective-C language as it
is implemented for NeXTSTEP. While clearly targeted
at NeXTSTEP, it is a good first-read to get to learn
Objective-C.
Articles
`Why I need Objective-C', by Christopher Lozinski.
Journal of Object-Oriented Programming (JOOP) September 1991.
Contact info@bpg.com for a copy and subscription to the BPG
newsletter.
Abstract: This article discusses the differences between C++
and Objective-C in great detail and explains why
Objective-C is a better object oriented language.
`Concurrent Object-Oriented C (cooC)', by Rajiv Trehan et. al.
ACM SIGPLAN Notices, Vol. 28, No 2, February 1993.
Abstract: This article discusses cooC, a language based on the
premise that an object not only provides an
encapsulation boundary but should also form a
process boundary. cooC is a superset of
Objective-C.
`Porting NEXTSTEP Applications to Microsoft Windows',
by Christopher Lozinski. NEXTWORLD EXPO Conference Proceedings,
San Francisco, CA, May 25-27, 1993. Updated version of the article
available from the author. Contact info@bpg.com.
Abstract: This article describes how to develop Objective-C
applications for both Microsoft Windows and
NEXTSTEP.
GNU Documentation
The GNU project needs a free manual describing the Objective-C
language features. Because of its cause, GNU cannot include the
non-free books in the GNU system, but the system needs to come with
documentation.
Anyone who can write good documentation, please think about giving
it to the GNU project. Contact rms@gnu.ai.mit.edu.
15 What kind of Objective-C support is provided by Stepstone?
Compilers and runtime for: Apple Macintosh (running Mac Programmers
Workshop), DEC Stations (ULTRIX), Data General AViiON (DG/UX),
HP9000/300,400,700,800 (HP-UX), IBM RISC System/6000 (AIX), MIPS,
NeXT, PC-AT (MS-DOS, OS/2), PS/2 (AIX), SCO/NCR UNIX SYS V, Sun 3, 4,
SPARCstations (SunOS or Solaris), Silicon Graphics INDIGO and VAX(VMS).
Other ports available by market demands or consulting services.
ICpak101 Foundation Class Library is available on all the above.
ICpak201 GUI Class Library is available on platforms that support
XWindows, Motif, OpenWindows and SunView.
The Stepstone Corporation
75 Glen Road
Sandy Hook, CT 06482
voice: 203 426 1875
voice: 800 BUY OBJEct
fax: 203 270 0106
16 What kind of Objective-C support is provided by NeXT?
The Objective-C compiler and libraries come bundled with the
NEXTSTEP Developer CD. The compiler essentially is GNU CC. For
information on the Kits which are part of NEXTSTEP, see the
ClassWare Listing (part 2 of this FAQ).
The sources to the NeXT-modified GNU products are available on the
developer CD, and from
ftp://ftp.next.com/pub/SoftwareDownloads/GNUSource/.
Products are:
NEXTSTEP 3.3, Mach/OpenStep 4.x, OpenStep/NT, Enterprise
Objects Framework (EOF), Portable Distributed Objects (PDO),
and WebObjects.
NeXT Computer, Inc.
900 Chesapeake Drive
Redwood City, CA 94063
voice: 800 848 NEXT
fax: 415 780 2801
email: NeXTanswers@NeXT.COM
www: http://www.next.com/
17 What kind of Objective-C support is provided by GNU?
GNU CC, since version 2, comes with an Objective-C compiler. The
current distribution of GNU CC (version 2.7.2.1) includes an
Objective-C compiler and runtime library. The latter includes the
`Object' and `NXConstantString' classes. In future distributions the
runtime library will be thread-safe. Some people are working on GNU
libraries, see part 2 of this FAQ (The ClassWare Listing) for details
or visit http://www.gnustep.org/.
If you haven't switched to a GNU CC as recent as 2.4 yet, here's one
reason to do so: The new runtime (as of 2.4) is more than 3 times as
fast as the old runtime (pre 2.4) w.r.t. method invocation.
Free Software Foundation
59 Temple Place -- Suite 330
Boston, MA 02111
+1-617-542-5942
General questions about the GNU Project can be asked to
gnu@prep.ai.mit.edu.
For information on how to order GNU software on tape or cd-rom, and
printed GNU manuals, check the file etc/ORDERS in the GNU Emacs
distribution, ftp the file /pub/gnu/GNUinfo/ORDERS on prep, or e-mail
a request to: gnu@prep.ai.mit.edu
By ordering your GNU software from the FSF, you help us continue to
develop more free software. Media revenues are our primary source of
support. Donations to FSF are deductible on US tax returns.
The above software will soon be at these ftp sites as well. Please
try them before prep.ai.mit.edu as prep is very busy!
thanx -gnu@prep.ai.mit.edu
ASIA: ftp.cs.titech.ac.jp, tron.um.u-tokyo.ac.jp/pub/GNU/prep
cair-archive.kaist.ac.kr/pub/gnu, ftp.nectec.or.th/pub/mirrors/gnu
AUSTRALIA: archie.au/gnu (archie.oz or archie.oz.au for ACSnet)
AFRICA: ftp.sun.ac.za/pub/gnu
MIDDLE-EAST: ftp.technion.ac.il/pub/unsupported/gnu
EUROPE: irisa.irisa.fr/pub/gnu, ftp.univ-lyon1.fr:pub/gnu,
ftp.mcc.ac.uk, unix.hensa.ac.uk/mirrors/uunet/systems/gnu,
src.doc.ic.ac.uk/gnu, ftp.ieunet.ie:pub/gnu, ftp.eunet.ch,
nic.sunsite.cnlab-switch.ch/mirror/gnu, ftp.win.tue.nl/pub/gnu,
ftp.nl.net, ftp.informatik.rwth-aachen.de/pub/gnu,
ftp.informatik.tu-muenchen.de, ftp.etsimo.uniovi.es/pub/gnu,
ftp.funet.fi/pub/gnu, ftp.denet.dk, ftp.stacken.kth.se,
isy.liu.se, ftp.luth.se/pub/unix/gnu,
ftp.sunet.se/pub/gnu, archive.eu.net
SOUTH AMERICA: ftp.inf.utfsm.cl/pub/gnu, ftp.unicamp.br/pub/gnu
WESTERN CANADA: ftp.cs.ubc.ca/mirror2/gnu
USA: wuarchive.wustl.edu/systems/gnu, labrea.stanford.edu,
ftp.digex.net/pub/gnu, ftp.kpc.com/pub/mirror/gnu,
f.ms.uky.edu/pub3/gnu, jaguar.utah.edu/gnustuff,
ftp.hawaii.edu/mirrors/gnu, uiarchive.cso.uiuc.edu/pub/gnu,
ftp.cs.columbia.edu/archives/gnu/prep,
archive.cis.ohio-state.edu/pub/gnu, gatekeeper.dec.com/pub/GNU,
ftp.uu.net/systems/gnu
[GNU FTP mirror site list dd Tue Jan 13 1997.]
18 Is Objective-C supported on <my favourite platform>?
Below is a list of compilers supporting Objective-C, and which are not
NeXT's, Stepstone's or plain GCC. [This section is being edited.]
Various platforms
Portable Object Compiler
The Portable Object Compiler runs on various UNIX platforms,
including AIX, OSF/1, Linux, NextStep, IRIX, HP-UX, SunOS and
Solaris. It is currently being ported to BeOS and WindowsNT.
The Portable Object Compiler is freely obtainable (comes with
source) from the Computer Algebra Objects website, currently
at, http://www.can.nl/~stes.
Included is a collection library, ObjectPak which compiles on,
and works with, Stepstone Objective C, GNU Objective C and
NeXT Objective C. This library also comes with source code.
[The Portable Object Compiler does not provide protocols.]
DOS, Windows, OS/2
BPG
BPG provides the Borland Extensions to Objective-C which
allows the Objective-C translator to be used with the Borland
Compiler, and makes it easy to develop Objective-C application
for Microsoft Windows.
BPG provides the Smalltalk Interface to Objective-C which
makes Objective-C objects look like Smalltalk Objects. It can
be used to build Graphical User Interface on portable
Objective-C objects, or to sell Objective-C libraries to
Smalltalk developers.
BPG provides the Objective-C Message Bus which sends
Objective-C messages across heterogeneous computer platforms.
BPG has a library of objects for modelling Objective-C
programs. A browser application has been built on this
library. Other potential applications include adding class
variables to Objective-C, adding runtime information about
instance variables, and method argument types, generating
object versions, and eventually building a browser/translator.
Christopher Lozinski
BPG
35032 Maidstone Court
Newark, CA 94560
Tel: +1 510 795-6086
fax: +1 510 795-8077
email: info@bpg.com
DJGPP
DJGPP includes Objective-C support [though I do not know to
which extent].
From the DJGGP homepage at http://www.delorie.com:
DJGPP is a complete 32-bit C/C++ development system for
Intel 80386 (and higher) PCs running DOS. It includes
ports of many GNU development utilities. The development
tools require a 80386 or newer computer to run, as do the
programs they produce. In most cases, the programs it
produces can be sold commercially without license or
royalties.
GCC/EMX
The EMX port of GCC implements Objective-C, and with RSX (or
RSXNT) it runs on DOS/DPMI boxes (or NT) too.
EMX is available for anonymous ftp on at following locations:
ftp://ftp.uni-stuttgart.de/pub/systems/os2/emx-0.9c
ftp://ftp-os2.cdrom.com/pub/os2/lang/emx09c
ftp://ftp-os2.nmsu.edu/os2/unix/emx09c
ftp://ftp.leo.org/pub/comp/os/os2/devtools/emx+gcc
ftp://src.doc.ic.ac.uk/packages/os2/unix/emx09c
RSX is available from
ftp://ftp.uni-bielefeld.de/pub/systems/msdos/misc/
Without RSX EMX is limited to DOS/VCPI and OS/2 >=2.0)
[Thanks to <huug@poboxes.com> for this information.]
GCC for Win32
Hyungjip Kim <hjkim@namo.co.kr> provides GCC 2.7.2 binaries
for Win32. This GCC is modified to generate CodeView
compatible debug information, to enable the use of existing
Windows debuggers. Visit http://www.namo.co.kr/~hjkim/objc/
for more information, and the binaries.
GNU-Win32
The GNU-Win32 project aims at providing the GNU tools
(including GCC) for Windows NT/95. [I do not know to which
extent Objective-C is supported.] Below is a description of
the project, taken from http://www.cygnus.com/misc/gnu-win32:
The GNU-Win32 tools are ports of the popular GNU
development tools to Windows NT/95 for the x86 and powerpc
processors. Applications built with these tools have
access to the Microsoft Win32 API as well as the Cygwin32
API which provides additional UNIX-like functionality
including UNIX sockets, process control with a working
fork and select, etc...
With these tools installed, it is now possible to:
write Win32 console or GUI applications that make use of
the standard Microsoft Win32 API and/or the Cygwin32 API.
easily configure and build many GNU tools from source
(including rebuilding the gnu-win32 development tools
themselves under x86 NT).
port many other significant UNIX programs to Windows NT/95
without making significant changes to the source code.
have a fairly full UNIX-like environment to work in, with
access to many of the common Unix utilities (from both the
bash shell and command.com).
The GNU-Win32 project is run by Cygnus; for more information
see http://www.cygnus.com.
Macintosh
Metrowerks
Preliminary Objective-C support for the MacOS will be included
in CodeWarrior Professional 1, to be released at the end of
May 1997. [Entry written Thu May 15 1997.]
Metrowerks Corporation
2201 Donley Drive
Austin, TX 78758
http://www.metrowerks.com/
phone: 1-800-377-5416, +1 512 873 8313
email: info@metrowerks.com
Tenon
Tenon CodeBuilder supports Objective-C. This product is based
on GNU CC and targeted at the Power Macintosh.
http://www.tenon.com/products/codebuilder/
19 What are the newsgroups to read or mailing lists to subscribe to in order
to stay up-to-date GNU Objective-C?
Read comp.lang.objective-c, which is bound to discuss current events.
There is a mailing list on GNU Objective-C: gnu-objc@gnu.ai.mit.edu.
To subscribe to this list, send a mail with your request to
`gnu-objc-request@gnu.ai.mit.edu.'
GNUstep has several newsgroups devoted to it: gnu.gnustep.announce and
gnu.gnustep.discuss to name but a few.
Furthermore, the various kits that are being developed each come with
their own mailing list. See part 2 of this FAQ for more information.
20 Are there any FTP sites with Objective C code? Where?
ftp://next-ftp.peak.org/pub/next/ (NEXTSTEP)
ftp://ftp.informatik.uni-muenchen.de
ftp://ftp.gnustep.org/pub/ (GNUStep)
ftp://ftp.stack.urc.tue.nl/pub/next/ (NEXTSTEP)
ftp://ccrma-ftp.stanford.edu/pub/NeXT/ (MusicKit a.o.)
ftp://ftp.informatik.uni-freiburg.de
ftp://ftp.cs.unl.edu/pub/ObjC (some sw and docs)
See also part 2 of this FAQ.
21 If there any information on the Net concerning Objective-C?
Basic and related Objective-C (and/or NeXTSTEP) information is available
at the following places:
NeXT at http://www.next.com/ with the NeXT Objective-C book at
http://www.next.com/Pubs/Documents/OPENSTEP/ObjectiveC/objctoc.htm,
Steve deKorte's Objective-C page at
http://www.batech.com/~dekorte/Objective-C/objc.html,
Brad Cox's Objective-C page at
http://www.virtualschool.edu/mon/Cox/ObjectiveC.html,
the GNUStep project at http://www.gnustep.org/, with a mirror at
http://www.nmr.embl-heidelberg.de/GNUstep
the libobjects FAQ at
ftp://ftp.cs.rochester.edu/pub/u/mccallum/libobjects/Gnustep-FAQ.html,
the NEXTSTEP/OpenStep Information Service at http://www.stepwise.com/,
the eduStep initiative at http://www.nmr.embl-heidelberg.de/eduStep/,
Cetus Links (http://www.rhein-neckar.de/~cetus/) has many links on OO;
Objective-C is on http://www.rhein-neckar.de/~cetus/oo_objective_c.html,
Nelson Minar's Objective-C page at
http://www.santafe.edu/~nelson/objective-c.html,
Tiggr's Objective-C page at http://www.ics.ele.tue.nl/tiggr/objc/,
Kennet Lerman's page at http://w3.nai.net/~lerman/,
Norihiro Itoh's page at http://www.etl.go.jp/etl/bunsan/~nito/,
and of course the HTML versions of this FAQ and associated information
at the addresses listed below.
22 For more information...
Visit one of the places mentioned in #21, or see part 2 of this FAQ,
Objective-C/classes a.k.a. the ClassWare Listing, for an [incomplete!]
overview of available Objective-C classes and libraries. See part 3 of
this FAQ, Objective-C/sample a.k.a. the Simple Sample Program, for an
example Objective-C program.
A Japanese language version of this FAQ is maintained by Norihiro Itoh
<nito@argotechnos.co.jp>. It is posted to fj.archives.answers regularly. A
hypertext version is maintained by Toru Sato <www-admin@cnds.canon.co.jp>
and is available at
http://www.cnds.canon.co.jp/Japanese_EUC/Contribution/FAQ_Objective-C/objc_faq_J.html.
A World Wide Web hypertext version of this FAQ is maintained by Brian Harvey
<theharv@csld.ucr.edu>. It is http://csld.ucr.edu/NeXTSTEP/objc_faq.html.
Another WWW version of this FAQ is maintained by Steve Dekorte
<dekorte@suite.com> at http://www.batech.com/~dekorte/Objective-C/objc.html.
The early version of this FAQ was compiled by Bill Shirley, with the aid of
many people. The current version is being maintained by Tiggr, aided by input
from a lot of people, including: Per Abrahamsen, Paul Burchard, Brad Cox,
Christopher Lozinski, Mike Mahoney, Jon F. Rosen, Paul Sanchez, Lee Sailer,
Paul Sanchez, Bill Shirley, Subrata Sircar, Ted Slupesky, Richard Stallman,
and Kersten Krab Thorup,
Any text in between `[' and `]' is a comment. Comments indicate `problems'
with this FAQ, which should be solved. Send your suggestions, additions,
bug reports, comments and fixes to `tiggr@ics.ele.tue.nl'.
The information in this file comes AS IS, WITHOUT ANY WARRANTY. You may
use the information contained in this file or distribute this file, as
long as you do not modify it, make money out of it or take the credits.