Alternatives to C++

Table of Contents

1 Alternatives to C++/Cpp

1.1 Overview

This notes provides alternatives to C++ programming language that can fulfill the following requirements:

  • Native code compilation
  • System programming language
  • No or optional garbage collector
  • High performance as C++
  • Compatibility with C or how easier is to call C-APIs (C-functions and structures).

Niches where C++ is used

  • HPC - High Performance Computing
    • CFD => Computational Fluid Dynamics (See: OpenFoam library)
    • FEM => Finite Element Methods
    • Computational Engineering
    • Oil and Gas
    • Geophysics
    • Astrophysics
    • Particle Physics
    • High Energy Physics
  • Games and computer graphics
    • Requirements: high performance and soft real time system.
  • System Programming
    • Kernel mode programming; device drivers; hardware interface; foundation libraries such as user interface toolkits and so on.
  • Embedded Systems (also can be regarded as system programming)
    • Resource constrained systems => Firmware running in microcontrollers, embedded computers, SBC - Single Board Computers and so on.
    • IoT - Internet Of Things
  • Foundational Libraries and software infrastructure:
    • Database servers
    • Operating Systems
      • Note: despite that most operating system used nowadays were written in C, it is possible to create operating systems or embedded operating systems in C++.
    • Device Drivers
    • Firmware
    • High performance math libraries that can be called from any programming language via foreign-function-interface or native-extension API (similar to JNI - Jave Native Interface).
    • GUI - Graphical User Interface Libraries
      • Qt
      • WxWidgets

Features of System Programming Languages

Some reasonable features that a System Programming Language should have are:

  • Compilation to native code
  • Stack allocation - Note: Most programming languages does not alllocate on the stack virtual memory segment of a process, only a few system programming languages are able to do it.
  • Bare metal compilation - compilation without operating system, for building kernel or firmware (embedded systems' program).
  • Be able to run without garbarge collector or to disable garbarge collector in resource constrained systems.
  • Interoperability with C - Support C calling convention and linking against C APIs and functions.
    • Languages with this feature: C++; DLang (D programming language); Rust; ADA;
    • Operating systems often expose functionalities and encapsulated system-calls for user-space applications via C libraries or runtime libraries exposing functions and symbols with C-calling convention and C-ABI (Application Binary Interface). Aside that, many foundational libraries are implemented in C or exposing C compatible-symbols, such as OpenGL API; OpenSSL; GTK GUI libraries and so on.
  • extern-"C" like statements - Support for creating C-compatible functions with C-calling convention.
    • Languages with this feature: C++; ADA; Rust; DLang (D programming language); Pascal; Fortran (Note: no a system prog. language).
    • Many operating systems, including Windows-NT and Linux and other Unix-like ones, define a C standard calling convention and ABI, which is the common denominator for binary interoperability. As a result, system programming languages, such as C++, DLang and Rust, provide extern-C like annotations for defining functions with C calling convention and C-ABI that allows calling those functions from any other language supporting C ABI or via FFI (Foreign-Function Interface).
    • This type of annotation allows creating: C-compatible libraries in C++ or Rust; Python native code modules (shared libraries) in C++ or Rust; create shared libraries that can be loaded via FFI foreign function interface from interpred languages such as Python, Ruby, JavaScript (NodeJS) and so on.
  • Inline assembly - Some sitatutions where inline assembly is needed are:
    • SIMD (Single-Instruction and Multiple Data) which is provide data parallelism, which is essential for high perfomance computing.
    • Access port-mapped IO instructions on x86 or x86-64 architecture.
    • Define functions with another calling convention.
    • Define ISR - interrupt-service routines, which may use other calling conventions.
    • Invoke operating systems' system calls.
    • Create CRT (C runtime libraries), such as GLIBC or MUSL that encapsulate system calls.
  • Support for Pointers
    • Memory reinterpretation - ability to cast pointers in order to access memory-mapped IO in kernel mode or in embedded devices.

What should be taken into consideration

  • Standardization
  • Availability of documentation and examples.
  • Availability of documentation about how to interface C-subroutines; call C libraries and link against C-libraries.
  • Reasonable standard library.
    • The standard library of most programming languages provide platform-agnostic: threads, sockets, file system access, coroutines, multiplexed-IO (non-blocking IO).
  • Availability of general and domain-specific libraries
  • Network Effect => Enough critical mass that enables community support and enough libraries.
  • Hardware Support:
    • Availability of compilers for different hardwares such as CPU core architectures; microcontrollers, DSP - Dgitial Signal Processors and so on.
    • Support from IC (Integrated Circuits) or Hardware Vendors
  • Compile-time speed:
    • Compile-time has a large impact on productivity as the workflow on many compiled-programming languages is edit, compile, fix compile-time errors and run. Longer the compile-time: more is spent on hourly rate; longer the development time and the time-to-market. The zero compile-time and fast iteration is one of the reasons dynamically-typed language, such as Python, Ruby, PHP are often chosen for web development.
  • Tooling support:
    • IDE - Integrated Development Support
    • Refatoring tools
    • Debuggers
    • Profilers for measuring peformance
    • Building systems
    • Package managers
  • IDE Support - some IDE services are invaluable such as:
    • code completion
      • Improves code discoverability and saves time that would be spent browsing the documentation or searching the source code.
    • code navigation
      • makes easier to view and jump between functions, classes, definitions and files. This service is essential for dealing with large code bases with hundreds or thousands of files.
    • Code refactoring => refactoring menu.
      • allows safe and fast changes such as renaming, changing method signature and so on.
    • Debugging interface to GDB, WindDBG (Windows Debugger), LLVM and so on.
      • Debuggers help fixing bugs by introspecting the program execution state and control flow at any given time and also allows user manipulation of program state and variables.
    • Integration with revision control systems or version control system such as GIT, SVN and etc.

Major Problems of C++

  • Slow compile-time
  • No pre-compiled libraries, project dependencies have to be compiled from source due to ABI incompatibility. This is why header-only libraries are popular.
  • Lack of module system
  • Macros and preprocessor
  • Code repetitition, every class' source file .cpp needs a matching header file which is not an interface as it exposes implementation details, for instance, the signature of private functions and private member variables need to be in header files.
  • Undefined behavior
    • Undefined behavior may cause bad surprises as it can cause bugs that are hard to detect and may go under the radar for a long time allowing a program to run with unpredictable and/or invalid state.
  • Object Model
    • => C++ uses multiple inheritance that has been proved to be flawed as it can cause the infamous diamond-of-death problem. Most object oriented programming languages solved it by only allowing single inheritance with multiple interface inheritance.
    • => Value semantics: C++ treats classes as primitive value and performs deep copy and passes all parameters by copy by default, however most of the time, classes are intended to be passed by reference and not by copy and it has to be done explicitly.
    • => Value semantics does not work with polymorphic types.
    • => Object Slicing
  • High Degree of Complexity
  • Binary compatibility among compilers.
  • Lack of ABI makes unfeasible to build C++ components or shared libraries without a C API. In C#, the user has just to add a DLL and in Java, the user has just to add jar package to include a dependency in a project. In C++, it is not possible, all dependencies need to compiled from source.
  • Complexity of building systems
  • No Standard Tooling - Despite that there are some widely used tools such as CMake "building system", they are still no standard. So, as result there are no:
    • NO standard package manager
    • NO standard building system


1.2 Alternatives Map

Listing of suitable C++ alternatives by field for better informed decisions about technology stack choice.

           + Packaged Software                  C# (CSharp) with WPF (Windows Presentation Foundation)
+------->> + Desktop Graphical GUIs  ------->   C# with Windows Form
|          + Desktop utilities                  Free Pascal with Lazarus IDE 
|                                               Java Swing 
|                                               Python + Qt with Pyinstaller for packaging
|                                               Alternatives 
|                                               [----------------------------]
|        (HPC) High Performance                 Fortran (commmercial compilers)
+----->> Numerical Computing  ------------->>   Julia language (drawbacks: more resource usage)
|        Or Scientific Computing                C language 
|                                              Alternatives 
|                                              [---------------------------]
|       System software                        C language
|       ----------------                       Rust 
+---->>  ( operating systems -------------->>  DLang (garbage collection can be disabled)
|        , device drivers,                     Zig language 
|        , background services                 Golang (if garbage collection is allowed)
|        , low level stuffs
|        , shared libraries
|        , implementation of interpreters 
|        )
|                                                        Alternatives 
|                                                       [-----------------------------]
|       Network Servers (TCP/IP, UDP/IP) ------------->> Golang 
+--->>  High performance and resource-efficient          Rust 
|                                                        DLang 
|                                                        OCaml 
|        Embedded Systems                               Alternatives 
|      --------------------------------------------->> [--------------------------]
+--->> + MCU - Microcontrollers                        C programming (there are architectures where only C is avaiable)
|      + MPU - Application Processors                  ADA 
|      + DSPs - Digital Signal Processors              Rust 
|      + Single Board Computers                        Zig language (not ready yet)
|      + Industrial Computers                          Forth 
|      + Car ECU (Engine Control Unit)                

1.3 General Purpose

1.3.1 Rust


  • Compilation to native code and web assembly.
  • Easy cross compilation to other operating systems and ISA (Instruction Set Architectures).
  • No gabarge collector, instead it uses its unique feature, the borrow-checker mechanism, for ensuring memory-safety and thread-safety.
  • Type inference feature which allows type-safe programming with minimum type annotations without the verbosity of Java.
  • Based on ML functional programming languages such as Haskell, OCaml and so on.
  • Modules (No header-files code duplication nightmare)
  • Standard building system and package manager: cargo - which makes it easier to reuse libraries and code.
  • Supported paradigms: imperative, functional programming, quasi-object oriented programming via traits.
  • Generic traits that are similar to C++ generic programming (template programming) with C++20 concepts. Note: Rust generics support type constraints.
  • Hygienic macros that unlike C or C++ macros, are flexible like lisp macros and also type-safe that can generate and modify Rust code at compile-time.
  • Endorsed by many companies such as: Microsoft, Mozilla, Apple, Amazon and so on. Rust is gaining traction as an safer system-programming language to C and C++.


  • Slow compile-time
  • Cannot call C-libraries directly as C++ can by using #include<> headers. - ref1
  • Less available libraries than C++.
  • Less talent pool than C++.
  • Lack of compilers for embedded targets can be a problem for embedded systems development.
  • Not all programming tasks requires high level of security such as: games, GUI (Graphical User Interfaces) and numerical computing. Applications that are most likely to require high level of security are the ones that runs with high privilege (kernel, device drivers, bootloader); deals with embedded systems and machine control, such as firmware or embedded operating systems; or deals with external untrusted input, such as parsers, interpreters, opcode virtual machines, network TCP/UDP/IP servers.
  • Lack of OpenMP support, which is a high performance computing (HPC) C and C++ language extension that allows harnessing multi-processor and multicore systems for parallelizing numerical code using simple preprocessor code annotations.
  • Vendoring C libraries (static linking C libraries) => C++ building systems, such as CMake, allow compiling and static linking against C libraries source dependencies placed in the same C++ source tree. Whereas, Rust's cargo building system is still not able to compile C source code in the same Rust source tree and link against the object code generated from the C library source code. Some libraries widely used C libraries in C++ code-bases are: GLFW, SDL, Lua language interpreter, GSL - Gnu Scientific Library and etc.

Online Books:

Big Tech Endorsement of Rust:




  • Rust for C++ developers - What you need to know to get rolling with crates - Pavel Yosifovich
    • Brief: "The session is about using the Rust language to write safe, concurrent and elegant code, contrasting with C++"
  • A Firehose of Rust, for busy people who know some C++ - Jack O'Connor
  • Building on an unsafe foundation - Jason Orendorff
    • Brief: "Beneath every safe programming language, library, or virtual machine is a whole lot of unsafe code. Rust is no exception. This talk will explain why “unsafe” code is allowed at all in a safe language, show the unsafe code at work inside safe features like Vec, and teach how to write a safe library that uses unsafe code."
  • How Do Programmers Use Unsafe Rust?
    • Brief: "Hello, I am Vytautas, a PhD student at ETH Zurich, supervised by Peter Müller. In our paper, we explored how and why programmers use unsafe Rust: a powerful and dangerous feature that allows disabling certain type-system checks.​"
  • Writing Linux Kernel Modules in Safe Rust - Geoffrey Thomas & Alex Gaynor
    • Brief: "Writing Linux Kernel Modules in Safe Rust - Geoffrey Thomas, Two Sigma Investments & Alex Gaynor, Alloy With 65% of recent Linux kernel vulnerabilities being the result of memory unsafety (buffer overflows, pointers used after being freed, etc.) and not logic errors, both kernel developers and downstream users have wondered whether it's possible to use a safer language than C for kernel development. This talk will explore the presenters' work building a framework for writing kernel modules in Rust and accessing kernel APIs in safe Rust. In particular, the talk will discuss some of the challenges of building binary-compatible kernel modules in Rust, techniques for working with existing C code, and how to design safe bindings over raw kernel APIs. It will also discuss advantages and difficulties for integrating Rust in upstream kernel development and possible directions the upstream kernel community could go."
  • EuroBSDCon - Rust: Systems Programmers Can Have Nice Things
    • Brief: "Rust is a new programming language, originally from Mozilla, that combines the safety and productivity of a high-level language with the performance and low-level control of a traditional systems language. Rust achieves this combination through clever and pragmatic programming language design — along with awesome tooling and libraries. In this talk, I will dive into the features that make Rust the right choice for 21st-century systems programming. I will give a general introduction to the language and an overview of the Rust ecosystem. I will also walk through the process of developing Rust on BSD."
  • Rust programming for the object-oriented developer
    • Brief: "If you've been curious about learning Rust, but have been scared off because you prefer object-oriented languages like Java, JavaScript, Python, Ruby and C++, then you should watch this talk! In this practical introduction, Tim covers a lot of material that has something for beginners and experienced programmers alike. How does Rust handle errors if there are no exceptions? How does Rust implement shared behavior if there is no inheritance?"
  • RustConf 2018 - Writing Crates for Complete Beginners
    • Brief: "Turtle is a Rust graphics crate for creating animated drawings. It is designed to be used to teach programming to complete beginners using Rust. In this talk, you'll learn the inner workings of turtle. We'll show you how we managed to create a library that is both full of features and very easy to learn. We'll go deep into how turtle works and tell you the key aspects of creating a crate that is accessible for anyone of any skill level. You'll leave with new ideas for your own crates and a good understanding of what went into making turtle so beginner friendly."
  • The Rust language: memory, ownership and lifetimes { 2014}
    • Brief: "In 2010, Mozilla announced it was working on a new systems language, aiming to match the performance and C-interoperability profile of C++ in a provably safe language with concurrency, immutability, isolation and expressiveness properties closer to languages like Erlang, Haskell or Scala. While Rust presents a good variety of familiar, expressive tools from other mainstream languages, it also borrows from research languages two lesser-known key technologies: "owning pointers" and "borrowed pointers". This talk will briefly describe the Rust language in general terms, then focus in on these two key technologies, how they shape Rust's memory model, performance and safety guarantees, and why you might consider using Rust in your next project."
  • Demo Zoo: Zero Cost Abstractions in C++20, Rust, & Zig
    • Brief: "Well, they aren't quite zero, but modern compilers for efficient languages do pretty well in this demo of abstract vector norm calculations in C++, Rust, & Zig."
  • Rust Concurrency Explained
    • Brief: "The Rust programming language purports the bold claim that it guarantees thread safety while retaining the ability to write zero-cost abstractions. In this talk we'll explore precisely how Rust can make such a claim. We'll also explore the ecosystem that makes up the concurrency toolkit in Rust to see how these language principles are extended to common abstractions such as channels, thread pools, work stealing algorithms, concurrent data structures, and asynchronous I/O."

1.3.2 D Language

D (DLang or D-Language) (2001)


  • Official Web Site:
  • The D Language was created by Walter Bright, a former Mechanical Engineer at Boeing and the creator of the first true C++ compiler Zortech C++. D was also co designed by Andrei Alexandrescu, a well-known C++ speaker, guru and author of the revolutionary book: 'Generic Programming and Design Patterns Applied'.
  • Note: When the C++ was created, it was first implemented as a preprocessor for generating C code.
  • Note: some people claim that D looks like a "compiled Python"


  • Multi-Paradigm
    • Imperative
    • Object Oriented Programming
    • Metaprogramming
    • Functional
    • Concurrent - actor model
  • Easier to learn for a C or C++ developer than Rust.
  • Inspired by: C, C++, C# (Csharp), Eiffel, Java and Python.
  • Native code compilation with static linking.
  • Much faster compile-time, D can even by used as a statically-typed scripting language.
  • Optional garbage collection => it can be disabled in application where it is not acceptable such as audio, system programming and games.
  • Modules
  • Design-by-contract
  • Metaprogramming Support
  • More comprehensive standard library
  • Built-in package manager and building system - dub
  • Central package repository:



Fixes lots of C++ problems due to earlier design decisions:

  • Classes are reference types => Instead of being passed by value by default, they are passed by reference implicitly without the C++ annotations for reference (&) or const referece(const &). It simplifies the language as one does not need to care about copy-constructors, move-constructors or potential problems of copy-constructor deep-copy or copy-overhead.
  • Provides structs that are value types like all C++ types and by value by default just as in C++ and C#. D Structs also allows RAII Resource-Acquisition-Is-Initialization technique for resource handling.
  • Fixes C++ multiple-inheritance diamond-of-death problem by allowing only single inheritance with multiple interface inheritance in a similar fashion to Java.
  • Fixes the object-slicing problem that happens when a polymorphic type is returned or passed by value losing its polymorphic abilities.
  • Provides ranges instead of complicated and non-composable iterator pair.
  • Modules, instead of C preprocessor which dramatically reduces the compile-time.


  • Plugins for enabling D language support in existing IDEs don't work out of the box.
  • Less tooling than C++
  • Lower popularity than Golang, Rust and so on.
  • Smaller community
  • Less IDE support and refactoring tools.
  • Unlike C, C++ or Rust still lacks industry recognition.
  • Less known than C++ or Rust.


Some DLang code bases

Some Videos

1.3.3 Golang

Go - Golang (2009)


  • Most used for Network Servers, Web Servers, Web Applications, distributed systems and message systems due its concurrency features such as go-routines based on Hoare's CSP - Communicating Sequential Processes.
  • Easier to learn for developers coming from languages such as Java, Python, and so on.
  • Lightweight threads (user-space threads), called Goroutines.
  • Wraps multiplexed IO, such as Slect (Unix), Poll (Unix), Epoll (Linux), KQueue (BSD) and IOCP (Windows), which allows handling multiple IO file descriptors and TCP/IP connections in a single thread.
  • Gabarge collector which automates memory managment.
  • Fast compile-time to native code. Fast compile-time also means fast iteration, faster development and less time-to-market.
  • Statically-linked native executables that can be deployed without any dependencies, in other words, just- works, just copy and run. Golang can also bypass the GlibC dependency-hell problem on Linux-based operating systems by performing system calls directly.
  • Pre-built binaries for all platforms!! Linux, Windows, and all possible platforms!! :)) :)
    • =>> As most golang applications are fully statically linked, developers can provide pre-built binaries for Linux and avoid the Linux package manager work-duplication problem.
    • =>> Easy Cross-compilation makes easier to build binaries for other platforms.
    • =>> Eliminate dependency on Linux package managers.
  • Multiple return values
  • Reflection
  • Avoids unsafe pointer arithmetics.
  • Array-bound checking.


  • "Ungoogable name" "go" which is hard to search about without getting many unrelated results as "go" is one of the most common words of the English Language, better search for "golang" or "go programming".
  • Not easy link against C libraries or C subroutines as in C++, DLang (D) or Rust.
  • Lack of generics and template metaprogramming.
  • Lack of exceptions
  • Lack of ternary operators
  • Gabarge collector can be a curse for the applications that C++ shines, namely, system programming, embedded systems, real-time systems (including games) and high performance computing.
  • Too much opinionated: A golang code may not even compile if a import is not used or curly braces are not formatted in a proper way.
  • Forces the code to be written in a single way and in a single style.

Best use-cases:

  • Command line tools
    • => GO is suitable for building portable command line applications, due to the compilation to native executable and static linking of dependencies which allows seamless deployment and portability across many Linux distributions.
  • Network Services; aka servers; web servers; TCP or UDP servers.
  • Network infrastructure tools
  • Distributed systems.
  • Micro services

Some projects built with Golang

  • Docker => Most used container runtime on Linux.
  • Kubernetes (k8)
  • Ubuntu Snap package manager (developed by Canonical)
  • Caddy Web Server (Nginx-like web server written in GOLang)
  • Hugo - Static web site generator
    • Brief: "Hugo is a static HTML and CSS website generator written in Go. It is optimized for speed, ease of use, and configurability. Hugo takes a directory with content and templates and renders them into a full HTML website. Hugo relies on Markdown files with front matter for metadata, and you can run Hugo from any directory. This works well for shared hosts and other systems where you don’t have a privileged account. Hugo renders a typical website of moderate size in a fraction of a second. A good rule of thumb is that each piece of content renders in around 1 millisecond. Hugo is designed to work well for any kind of website including blogs, tumbles, and docs."
  • CockroachDB
    • Brief: "CockroachDB is a cloud-native SQL database for building global, scalable cloud services that survive disasters."
  • Teleport
    • Brief: "Teleport is an identity-aware, multi-protocol access proxy which understands SSH, HTTPS, Kubernetes API, MySQL and PostgreSQL wire protocols. On the server side, Teleport is a single binary which enables convenient secure access to behind-NAT resources such as: SSH nodes - SSH works in browsers too! Kubernetes clusters PostgreSQL and MySQL databases Internal Web apps Teleport is trivial to set up as a Linux daemon or in a Kubernetes pod. It's rapidly replacing legacy sshd-based setups at organizations who need: Developer convenience of having instant secure access to everything they need across many environments and cloud providers. Audit log with session recording/replay for multiple protocols; Easily manage trust between teams, organizations and data centers. Role-based access control (RBAC) and flexible access workflows (one-time access requests)"
  • Terraform
    • Brief: "Terraform enables you to safely and predictably create, change, and improve infrastructure. It is an open source tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned."

1.3.4 NIM

  • Nim Language (2008)
    • Official Web Site:
    • Features:
      • Native code compilation by generating C-code (Nim is a transpiler)
      • Simple syntax
      • Gabarge Collection
    • Problems:
      • Did not reach version 1.0 yet. Still under development.
      • Less tooling support.
      • Gabarge Collection can also be a problem in performance-critical applications.

1.3.6 ATS - Applied Type System

ATS Programming Language (2015)


  • Systems Programming
  • Device drivers
  • Embedded Systems
  • High performance libraries


  • Statically-typed functional programming language based on Standard ML (OCaml) that transpile to C, or generate C-code.
  • C-interoperability
  • Can take advantage of the availability of C-compilers for many platforms, hardwares and devices.
  • Memory-safe
  • All ML perks: pattern matching; algebraic data types and so on.
  • Can run without garbage collector.
  • Can compile or generate code to: C, JavaScript and Erlang.


  • New programming language
  • May not be mature enough.
  • Sparse documentation

1.4 Scientific and numerical computing

  • Fortran (1954)
  • Julia Language (2012)
    • Value proposition: Syntax and convenience of Matlab and Fortran; almost the speed of C and C++; flexibility and convenience of Python.
    • Features:
      • Dynamically typed with optional type anntations.
      • JIT - Just In Time compiler. The script code is compiled to machine code during runtime which increases the performance.
      • Built-in types convenient for numerical computing: arrays; matrices; multi-dimensional arrays.
      • Interoperability:
        • Can use Python packages via CPython native interface C API.
        • Can call C++, C or Fotran.
      • No need to vectorized for-loops which decreases the performance in Matlab; Python + Numpy; Octave; Scilab and so on.
      • Support for functions and variables with unicode symbols such as greek letters: δ, ∇, ι …
      • Multiple Dispatching
      • Lisp-like macros and metaprogramming features.
    • Disadvantages:
      • Slow startup time
      • Not suitable for low latency applications, such as games, since Julia is a garbage collected language.
      • Less efficient. Despite the possible performance gains, Julia still uses more CPU time and memory resources than C++, which is still one of the best ways to get the maximum ROI (Return on Investment) on the hardware and take full advantage of every penny spent on it.
    • Best use cases:
      • Scientific and numerical computing
      • Machine learning
      • Engineering design
      • Prototyping numerical algorithms and numerical methods before a more efficient implementation in C++ or any other more efficient language.

1.5 Embedded Systems or Real Time Systems

Ada - programming language (1980)

Some Videos:

1.6 Graphical User Interface RAD - Rapid Application Development

  • Free Pascal Programming Language + Lazarus
    • Official Web Site:
    • Other sites:
    • Lazarus is an open source IDE for Object Pascal programming language where is possible to build graphical user interface fast visually by picking and placing user interface components in the same fashion as Visual Basic or Borland Delphi (now Embarcadero Delphi).
    • Features:
      • Based on Borland Delphi
      • Compilation to native code
      • Much Faster compile-time than C++
      • Can ship the application as a single executable which makes the deployment of Desktop GUI apps easier.
      • Build graphical user interfaces fast by dragging and dropping UI components like in Visual Basic 6 or Embarcadero (Old Borland) Delphi.
      • Static compilation with all dependencies.
      • Cross-platform - the same project can be recompiled with the IDE on Windows, Linux and Mac-OSX.
      • Lots of built-in user interface components
      • Can reuse Delphi components
      • Lots of database connectivity components
      • Ability to call C-APIs, C-code and shared libraries. C++ code can be called with a C-interface (extern "C" …)
    • Problems:
      • Some people may not like object-pascal syntax that is different from the C-like syntax.
      • Small community
      • Scattered documentation
      • Without proper discipline, the application can easily become an spaghetti as it is easier to mix the application code with the graphical user interface GUI code, although this shortcoming can be mitigated with MVC - Model View Controller.
    • Applications built with Lazarus IDE + Object Pascal

1.7 C++ code as a component or as Library

  • Shared Library with C-interface
    • The C++ code can be turned into a shared library by manually writting a C-interface (lots of extern "C") that can be loaded from any programming language via foreign-function interface such as Python C-types, Java JNA or .NET / C# P-invoke.
  • Shared Library with Programming Language Specific C native interface
    • Many programming languages such as Python, Ruby or Java (JNI) are written in C or C++ and provide a native interface API where is possible to create native modules or libraries in C and load them as they were ordinary libraries. So, a C++ code can be turned into a Python library by compiling the code with its bindings or adapter code for Python native API. The drawback of this approach is that, it will be hard to reuse the library with other programming languages.
  • Swig Wrapper Genrator
    • The SWIG wrapper generator parses Swing interface files, C and C++ header files and then generates binding code for a native C interface of some specified programming language. So, SWIG can generate native Python, Ruby or Java and other languages native libraries.

1.8 C++ with Embedded Scripting Languages

Embedded programming languages can make easier for non-technical or non-programming users to extend, configure and customize applications without any recompilation. They also allow end users to build add-ons, extensions or plugins. This approach is widely used by games for allowing non-programmers to create higher level logic, gameplay, animation and mods. Some programming languages were designed specifically to be embedded:

  • TCL - Tool Command Language (1988)
    • Widely used as embedded scripting language in EDA - Electronic Design Automation Tool. This happens due to the language creator, John Ousterhout, initially develped TCL as an scripting extension language for EDA applications.
    • See:
  • Lua (Moon in Portuguese) Programming Language (1993)
  • Python (CPython implementation) (1991)
  • mruby - Embeddedable Ruby Implementation
    • Github:
    • "mruby is the lightweight implementation of the Ruby language complying to (part of) the ISO standard. Its syntax is Ruby 1.9 compatible. mruby can be linked and embedded within your application. We provide the interpreter program "mruby" and the interactive mruby shell "mirb" as examples. You can also compile Ruby programs into compiled byte code using the mruby compiler "mrbc". All those tools reside in the "bin" directory. "mrbc" is also able to generate compiled byte code in a C source file, see the "mrbtest" program under the "test" directory for an example."
  • Scheme / Lisp (Chibi Scheme Implementation)
  • Scheme / Lisp (TinyScheme Implementation)

Created: 2021-06-07 Mon 08:09