ObjFW  Update of "ObjFW"

Overview

Artifact ID: b9725f23617a27bac0e8f1628f71012343c821fe4ddcc6095f5a55430d8d8661
Page Name:ObjFW
Date: 2020-05-23 14:20:32
Original User: js
Mimetype:text/x-markdown
Parent: 35b2b00317b4aa8b51c16372f6282c31c9d7c668631f0812373495d3752037b0 (diff)
Next 93432523b9572a28ffb792b60c1543da59f1adbf1461c18c77f450488eee8b43
Content

ObjFW project pageā€¦ or more precisely an FAQ

What is ObjFW?

ObjFW is a portable, lightweight framework for the Objective-C language.

Why would I need ObjFW?

It enables you to write an application in Objective-C that will run on any platform supported by ObjFW without having to worry about differences between operating systems or various frameworks you would otherwise need if you want to be portable.

This all sounds great! Where can I get it?

You can get ObjFW 0.90.2 here (PGP signature) and get the documentation for 0.90.2 here (PGP signature).

You can clone the Fossil repository like this:

mkdir objfw
cd objfw
fossil clone https://objfw.nil.im .fossil
fossil open .fossil
Or you can get it from Git. To clone the source tree, just type:
git clone https://git.nil.im/objfw.git
There is also a GitHub project that you can star, clone and fork.

Alternatively, you can browse the latest revision here.

What license does ObjFW use?

ObjFW is available under the terms of the QPL, GPLv2 or GPLv3. The license text for all three is included in the tarball and you can choose which one to use.

If none of these licenses is acceptable for you, please contact me so we can find a solution (please don't hesitate to do so, as it does not mean you have to pay something!).

But why a new framework? There's Cocoa and GNUstep!

ObjFW is quite different from Cocoa or GNUstep.

If you want to write an application that is not limited to Mac OS X and its Cocoa, you are usually told to port it to GNUstep. But this is already where it starts: You have to port it. And there are differences between Cocoa and GNUstep which can be quite huge sometimes. Cocoa does not have some stuff anymore that's still in GNUstep and GNUstep often does not have stuff that was introduced in Cocoa. So why not have a framework that runs everywhere - on Mac OS X, on other Unices like Linux, Windows and even very obscure platforms? This way you don't have to write your code for Cocoa and GNUstep. If a function exists in that portable framework, you can be sure it works on any platform. And that portable framework is exactly what ObjFW is.

But it has more differences than that. If you don't plan to be portable, it still offers advantages. For example, GNUstep is still designed for gcc 3.x and does not make use of any features of newer GCCs. But gcc 3.x had very poor ObjC support. It even has advantages to Cocoa: For example, it makes use of exceptions not just for programmer errors, but for other serious errors as well. This way, either the programmer has to handle the error or the program will abort, which can avoid some really nasty bugs and even security holes sometimes.

Another advantage is that ObjFW only includes the core stuff. If you don't want all that GUI stuff and want to write a server, you might be quite unhappy about all the stuff that GNUstep for example needs. And about how badly it integrates into the Unix FHS. With ObjFW, your application will not look different to a native application to the user. A server can just link ObjFW and does not need some "strange" directory structure etc.

Last but not least, you can also mix ObjFW with Cocoa because ObjFW uses a different prefix (OF instead of NS). For example, you can write your application core using ObjFW, but write your GUI using Cocoa and later add a Gtk+ or Qt GUI for Unices, using the same core. Mixing with Swift is also possible!

On which platforms does it work?

I recommend looking at the PLATFORMS.md file which is updated as soon as new platforms are tested. But usually, it should work on any POSIX system to which gcc4 or a recent version of LLVM (either llvm-gcc or clang) has been ported. It also works on non-POSIX systems like Windows. This is not an exhaustive list, just platforms that have been tested.

Where can I find documentation?

The documentation is included in the source code. To generate it, you need doxygen. Once you installed doxygen, you can generate it by typing doxygen in the root directory of ObjFW.

You can also browse the documentation for 0.90.2 online.

But the documentation does not say how to compile my code that uses ObjFW!

The easiest way to compile a program using ObjFW is to use objfw-compile. You can use it like this:

objfw-compile -o myapp source1.m source2.m
You can also use objfw-config to get the CPPFLAGS, OBJCFLAGS, LIBS and LDFLAGS required to compile code that uses ObjFW. For example, you could do it like this:
clang -Wall `objfw-config --all` -o foobar foobar.m
Or, if you don't want to do compilation and linking in one step:
clang -Wall `objfw-config --cppflags --objcflags` foo.m
clang -Wall `objfw-config --cppflags --objcflags` bar.m
clang `objfw-config --ldflags --libs` -o foobar foo.o bar.o

Is there a list of 3rd-party libraries for ObjFW?

Yes! There is a wiki page where 3rd-party libraries for ObjFW are listed. However, this list is not official and everybody may add a 3rd-party library there!

I have further questions / feature requests / found a bug. What should I do?

Please join the Matrix Chat, which you can also join via IRC (#objfw on Freenode).

Alternatively feel free to mail me at js-spam@nil.im (remove the -spam).

I really like ObjFW. Can I donate?

Sure! If you want to show your appreciation, you can send Bitcoins to 1LobVDvKotgkL15ByK2epQdUwaXJ1GoQWt.