Jump to content

Extract public parts of a given Delphi unit source code file

Recommended Posts


I have written a library to make use of Firemonkey from the programming language D.

Therefore I need to generate D wrapper classes / structures / enumerations for the Delphi classes / records /....




alias TCloseEvent = void delegate(TObject sender, ref TCloseAction action);
alias TCloseQueryEvent = void delegate (TObject sender, ref bool canClose);

enum TDeviceKind {

enum TFormPosition {Designed, Default, DefaultPosOnly, DefaultSizeOnly, ScreenCenter, DesktopCenter, MainFormCenter, OwnerFormCenter};

alias TDeviceKinds = TDeviceKind[]; // TODO Set of TDeviceKinds

class TFormFactor: TPersistent
	mixin(GenSetProperty!("Devices", TDeviceKind));
	this(int reference)

This is a manual and error prone effort. I wonder whether there is maybe a tool included in Delphi which gives me the info about the classes / records / ... for a given Delphi unit source code file

like FMX.Forms.pas.  Best solution would be if I can get the info as JSON / XML after the IFDEFs are sorted out by the compiler...

Based on the JSON then I could easily generate the D artifacts.


Is there something like this available?


Kind regards






Share this post

Link to post

Try DelphiAST (link in my signature). Or you can try to find some pas-to-h converters (not sure they exist at all) which D should eat as well.

  • Thanks 1

Share this post

Link to post

If you have RAD Studio (ie you also have C++ Builder) then the C++ FMX header files may be useful here.... Not sure about copyright / license restrictions on their use though....

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now