dlang / project-ideas

Collection of impactful projects in the D ecosystem
36 stars 12 forks source link

Add Delphi support to autowrap #67

Open andre2007 opened 4 years ago

andre2007 commented 4 years ago

Description

The aim of this project is to enable the D community to write multi operation system GUI application using an IDE. Delphi allows to write GUI application for Windows / MacOS, Android and iOS using a single code line. It has a highly sophisticated UI toolkit (FireMonkey) while UIs can be easily clicked together. Delphi has a a free community version (with restrictions also free for commercial projects). In addition it integrates very well with the different stores (Microsoft Store, Android Playstore, ...).

By adding support for Delphi to autowrap, D classes and their methods / attributes can be directly called from Delphi code (e.g. Button handlers) as if they were written in Delphi.

Example: A dub project has a dependency to autowrap and has the targetType dynamicLibrary. It has a module lib.d with this coding:

module lib;

import autowrap.delphi;

class Foo
{
    void bar(int i)
    {
        return i;
    }
}

mixin(
    wrapDelphi(
        Modules(
            Module("lib")
        ),
        OutputFolder("includes"),
        LibraryName("dmodules"),
    )
);

Command dub build will create a file dmodules.so and also a file includes/lib.pas. In Delphi the folder includes is known. lib.pas contains a Delphi class Foo which will forward all method calls, attribute read / writes,... to the D code within dmodules.so.

What are rough milestones of this project?

How does this project help the D community?

Finally it would be possible to write GUI applications for Windows / MacOS and the mobile world in a straight forward way. Just use a very thin Delphi layer and call directly into D classes.

Known issues

Recommended skills

Delphi

(If applicable, e.g. GSoC/SAoC)

What can students expect to get out of doing this project?

Point of Contact

## References https://github.com/symmetryinvestments/autowrap/issues/249