Skip to content

jdolan/Objectively

Repository files navigation

Build Zlib License Stable

Objectively

Object oriented framework for C.

Zlib license.

About

Objectively is a cross-platform framework that provides rich object-oriented semantics to enable OOP in the C programming language.

Features

  • Cross-platform support for Android, iOS, macOS, Linux and Windows
  • Single-parent inheritance with starts-with struct composition
  • Class and instance methods with strongly typed interfaces
  • Automatic class loading and lifecycle management
  • Automatic memory management with reference counting
  • Unicode strings with mutlibyte character support
  • Collections for Objects and C types: Array, Dictionary, List, Set and more
  • Concurrency: Lock, Condition, Thread, Operation, OperationQueue
  • Networking: URLSession, JSONContext & RESTClient

tl;dr

Objectively brings classes, single-parent inheritance, strongly typed methods and reference counting to plain C — no C++, and no code generation.

Declare a type once, then instantiate and use it like any other:

Hello *hello = $(alloc(Hello), initWithGreeting, "Hello, World!");

$(hello, sayHello);

hello = release(hello);

alloc and release manage the lifecycle, $ dispatches through the type's interface, and super, method overrides and shared instances all behave exactly as you'd expect from an object oriented language.

Getting Started

Consult the Installation guide for dependencies, building, and linking.

User Guide

Consult the User Guide to write your first Class.

API Documentation

Browse the API Documentation to explore the library.

Examples & projects using Objectively

  1. Objectively test suite provides examples for using every Objectively C type.
  2. ObjectivelyGPU is a framework for modern graphics built on SDL3 and Objectively.
  3. ObjectivelyMVC is a framework for modern game interfaces built on SDL3, Objectively and ObjectivelyGPU.
  4. Quetoo is a free first-person shooter that uses Objectively, ObjectivelyGPU and ObjectivelyMVC extensively.

ObjectivelyGPU Hello — a spinning, multisampled 3D cube ObjectivelyGPU HelloCompute — particles animated by a compute shader ObjectivelyMVC Hello - a simple in-game menu

About

Object oriented framework and core library for GNU C. Inspired by Objective-C. Zlib license.

Topics

Resources

License

Stars

41 stars

Watchers

6 watching

Forks

Sponsor this project

 

Packages

 
 
 

Contributors

Languages