Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Delphi support to autowrap #67

Open
andre2007 opened this issue Jun 24, 2020 · 0 comments
Open

Add Delphi support to autowrap #67

andre2007 opened this issue Jun 24, 2020 · 0 comments

Comments

@andre2007
Copy link

andre2007 commented Jun 24, 2020

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?

  • Generate Delphi wrapper code for D classes / functions
  • Get Windows applications running
  • Get Android applications running
  • Get MacOS applications running
  • Get iOS applications running

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

  • Delphi cannot resolve circular references. Developer is forced to write code without circular references or in some cases resolve them using forward declarations.

  • D does not allow writing files (pascal wrapper files) during compile time. A workaround could be the usage of dub postGenerate hook. Write files on CTFE symmetryinvestments/autowrap#250

Recommended skills

Delphi

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

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

Point of Contact

References

symmetryinvestments/autowrap#249

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant