www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - (Oh My) Gentool 0.4.0 released

reply evilrat <evilrat666 gmail.com> writes:


It is my fancy tool to generate extern(C++) stuff quicker, it 
takes regular compiler flags that you usually pass to clang and 
translates C/C++ code to D.

This release has one new feature: support pragma mangle on 
aggregates (class, struct, etc...).

Also a lot of work was put into template support, but it is still 
has lots of unhandled cases, so do not expect it will translate 
STL or Boost without need of manual fixes.

Source
https://github.com/Superbelko/ohmygentool

Windows binaries
https://github.com/Superbelko/ohmygentool/releases/tag/v0.4.0
Jun 06
next sibling parent reply sighoya <sighoya gmail.com> writes:
On Sunday, 6 June 2021 at 10:03:11 UTC, evilrat wrote:


 It is my fancy tool to generate extern(C++) stuff quicker, it 
 takes regular compiler flags that you usually pass to clang and 
 translates C/C++ code to D.

 This release has one new feature: support pragma mangle on 
 aggregates (class, struct, etc...).

 Also a lot of work was put into template support, but it is 
 still has lots of unhandled cases, so do not expect it will 
 translate STL or Boost without need of manual fixes.

 Source
 https://github.com/Superbelko/ohmygentool

 Windows binaries
 https://github.com/Superbelko/ohmygentool/releases/tag/v0.4.0
+1 How did you parse C++ code which seems overkill to do alone. Did you enact clang for?
Jun 06
parent evilrat <evilrat666 gmail.com> writes:
On Sunday, 6 June 2021 at 10:38:22 UTC, sighoya wrote:
 On Sunday, 6 June 2021 at 10:03:11 UTC, evilrat wrote:


 It is my fancy tool to generate extern(C++) stuff quicker, it 
 takes regular compiler flags that you usually pass to clang 
 and translates C/C++ code to D.

 This release has one new feature: support pragma mangle on 
 aggregates (class, struct, etc...).

 Also a lot of work was put into template support, but it is 
 still has lots of unhandled cases, so do not expect it will 
 translate STL or Boost without need of manual fixes.

 Source
 https://github.com/Superbelko/ohmygentool

 Windows binaries
 https://github.com/Superbelko/ohmygentool/releases/tag/v0.4.0
+1 How did you parse C++ code which seems overkill to do alone. Did you enact clang for?
Yes, it's all clang under the hood. But it's not just clang tooling that uses pre-made Tool class that has to be invoked as part of clang itself using special flag. Instead it creates compiler instance and runs regular compilation pass in memory extracting declarations recursively (as part of older pipeline, can be done to some extent using C API with cursors), and then it converts C++ AST to D source code with minimal AST manipulation (can't be done with C API), though I'm looking into AST-to-AST translation instead and then using D compiler frontend to emit source code for better result.
Jun 06
prev sibling next sibling parent reply Andrea Fontana <nospam example.org> writes:
On Sunday, 6 June 2021 at 10:03:11 UTC, evilrat wrote:


 It is my fancy tool to generate extern(C++) stuff quicker, it 
 takes regular compiler flags that you usually pass to clang and 
 translates C/C++ code to D.

 This release has one new feature: support pragma mangle on 
 aggregates (class, struct, etc...).

 Also a lot of work was put into template support, but it is 
 still has lots of unhandled cases, so do not expect it will 
 translate STL or Boost without need of manual fixes.

 Source
 https://github.com/Superbelko/ohmygentool

 Windows binaries
 https://github.com/Superbelko/ohmygentool/releases/tag/v0.4.0
Nice work. Is there a docker somewhere in order to test it?
Jun 07
parent reply evilrat <evilrat666 gmail.com> writes:
On Monday, 7 June 2021 at 09:45:53 UTC, Andrea Fontana wrote:
 On Sunday, 6 June 2021 at 10:03:11 UTC, evilrat wrote:


 It is my fancy tool to generate extern(C++) stuff quicker, it 
 takes regular compiler flags that you usually pass to clang 
 and translates C/C++ code to D.

 This release has one new feature: support pragma mangle on 
 aggregates (class, struct, etc...).

 Also a lot of work was put into template support, but it is 
 still has lots of unhandled cases, so do not expect it will 
 translate STL or Boost without need of manual fixes.

 Source
 https://github.com/Superbelko/ohmygentool

 Windows binaries
 https://github.com/Superbelko/ohmygentool/releases/tag/v0.4.0
Nice work. Is there a docker somewhere in order to test it?
It's got a dockerfile few days back, though I haven't tried it myself yet. (SSH port at end is for IDE's) https://github.com/Superbelko/ohmygentool/blob/master/Dockerfile.local-dev It detects standard library includes automatically, but if you're going to cross compile you'll have to tell it where to look, also probably need to pass proper target triple.
Jun 07
parent evilrat <evilrat666 gmail.com> writes:
On Monday, 7 June 2021 at 10:15:28 UTC, evilrat wrote:
 On Monday, 7 June 2021 at 09:45:53 UTC, Andrea Fontana wrote:
 On Sunday, 6 June 2021 at 10:03:11 UTC, evilrat wrote:


 It is my fancy tool to generate extern(C++) stuff quicker, it 
 takes regular compiler flags that you usually pass to clang 
 and translates C/C++ code to D.

 This release has one new feature: support pragma mangle on 
 aggregates (class, struct, etc...).

 Also a lot of work was put into template support, but it is 
 still has lots of unhandled cases, so do not expect it will 
 translate STL or Boost without need of manual fixes.

 Source
 https://github.com/Superbelko/ohmygentool

 Windows binaries
 https://github.com/Superbelko/ohmygentool/releases/tag/v0.4.0
Nice work. Is there a docker somewhere in order to test it?
Added image to dockerhub https://hub.docker.com/r/superbelko/gentool Get it using `docker pull superbelko/gentool` How to use https://github.com/Superbelko/ohmygentool/wiki/Docker
Jun 08
prev sibling parent Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Sunday, 6 June 2021 at 10:03:11 UTC, evilrat wrote:


 It is my fancy tool to generate extern(C++) stuff quicker, it 
 takes regular compiler flags that you usually pass to clang and 
 translates C/C++ code to D.

 This release has one new feature: support pragma mangle on 
 aggregates (class, struct, etc...).

 Also a lot of work was put into template support, but it is 
 still has lots of unhandled cases, so do not expect it will 
 translate STL or Boost without need of manual fixes.

 Source
 https://github.com/Superbelko/ohmygentool

 Windows binaries
 https://github.com/Superbelko/ohmygentool/releases/tag/v0.4.0
Splendid work, keep it up
Jun 07