Skip to content

Port to Rust #704

@egli

Description

@egli

Implementing liblouis in C has many benefits:

  • runs basically on any platform from desktop to embed system
  • enables bindings to many languages

on the other hand it has a number of downsides:

  • real cross platform is tricky. The autotools build system isn't really native to windows for example
  • the standard libs are poor, so we have home grown implementations of hash maps, lists, a hand written parser, etc.
  • the manual memory management leads to quite a few memory leaks and probably buffer overruns

This is why the idea of a port of liblouis to a modern language has been around for some time. But in order to keep the good parts we need to be able to provide a C ABI.

That is where Rust comes in:

  • it is a modern language
    • with proper data structures, collections, better error handling, etc
  • cross platform build seems easy
  • it can export and consume a C ABI
  • it can be linked to C code

Now rewriting a piece of software such as liblouis seems like a daunting task. That is where the idea of a gradual port comes into play. Rewrite it piece by piece.

Some people have apparently done this successfully for other legacy C code bases:

Metadata

Metadata

Assignees

No one assigned

    Labels

    future directionEnhancement to the API or table format that is important for the long-term strategy (but not urgent)refactoringCode changes that do not result in visible changes in the behavior of Liblouis

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions