www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Yet another binding generator (WIP)

reply evilrat <evilrat666 gmail.com> writes:
Hi,
Early access program is now live!
Limited offer!
Preorder until 12.31.2017 BC and you will receive* unique pet - 
"Cute Space Hamster"!
!!
*(Limited quantity in stock)

Ok, enough BS...
So here is my personal tool for generating extern(C)/extern(C++) 
bindings[1].
I know there is several other tools exists, but this one is mine.
Currently it is in early pre-pre-pre-alpha stage, and is probably 
doesn't even work on any somewhat serious codebase. Might not 
work on Linux, or Mac, or just any non-Windows 10 OS.
There is example output in the repo, and the list of current 
features and known issues.

So what it can actually do?
Might work to do C conversion without manual editing, but in 
practice C stuff use a lot of defines as constants, so you will 
have to find them and write by hand, not convenient, true.
Might work with basic C++ headers without much of 
templates/inlines/defines-as-constants

Give it a try and let me know if you find something that is not 
on the limitations list, I will add it to the list, and everyone 
will be happy again!


p.s. no, it is not belongs to the announce group, as the tool 
itself is still far away from being truly useful, but it might 
accelerate your binding making process as well, for example 
making bulk of code output and then manually adjust some stuff 
once per month isn't that much effort comparing to doing 
everything by hand, not even mentioning doing it on per month 
basis...


[1] https://github.com/Superbelko/ohmygentool
Oct 01 2018
next sibling parent reply JN <666total wp.pl> writes:
On Monday, 1 October 2018 at 13:51:10 UTC, evilrat wrote:
 Give it a try and let me know if you find something that is not 
 on the limitations list, I will add it to the list, and 
 everyone will be happy again!
Are there Windows binaries available somewhere?
Oct 01 2018
parent evilrat <evilrat666 gmail.com> writes:
On Monday, 1 October 2018 at 13:59:42 UTC, JN wrote:
 Are there Windows binaries available somewhere?
Try this https://1drv.ms/u/s!AgMDJgyotPu6ljpA5_GwX898gAcg It is x64 debug build without PDB. But from my experience it will not work due to debug C++ runtime being used. At least not without VS 2017 installed.
Oct 01 2018
prev sibling next sibling parent reply Stefan Koch <uplink.coder googlemail.com> writes:
On Monday, 1 October 2018 at 13:51:10 UTC, evilrat wrote:
 Hi,
 Early access program is now live!
 Limited offer!
 Preorder until 12.31.2017 BC and you will receive* unique pet - 
 "Cute Space Hamster"!
 !!
 *(Limited quantity in stock)

 [...]
How does it compare to dstep?
Oct 01 2018
parent reply evilrat <evilrat666 gmail.com> writes:
On Monday, 1 October 2018 at 15:35:30 UTC, Stefan Koch wrote:
 On Monday, 1 October 2018 at 13:51:10 UTC, evilrat wrote:
 Hi,
 Early access program is now live!
 Limited offer!
 Preorder until 12.31.2017 BC and you will receive* unique pet 
 - "Cute Space Hamster"!
 !!
 *(Limited quantity in stock)

 [...]
How does it compare to dstep?
To be honest I don't know. Also dstep is written in D and using only 'stable' clang C API, right? This tool is based on full 'unstable' C++ API, so in theory it is possible to do broader range of features, such as template substitution for wrapper generating (or just writting .cpp file for compiler to generate actual code). If you asking about actual C/C++ support I have no idea, also dstep is probably can do Objective-C as well (but not this tool), and on average at this moment dstep probably has better C support. Recently there is also "dpp" showed up, it also seems to do same C API approach as dstep, probably has little-to-none C++ support, might be wrong though. Oh wait, no Windows? nice... But if you only ever do linux stuff and C only then it probably even better choice. There is also Calypso (which I assume won't work on Windows as well), that probably should just work with anything you throw in. But this approach has one small downside - no autocompletion and syntax checking.
Oct 01 2018
next sibling parent Jacob Carlborg <doob me.com> writes:
On 2018-10-02 03:25, evilrat wrote:

 To be honest I don't know. Also dstep is written in D and using only 
 'stable' clang C API, right?
Yes.
 This tool is based on full 'unstable' C++ API, so in theory it is 
 possible to do broader range of features, such as template substitution 
 for wrapper generating (or just writting .cpp file for compiler to 
 generate actual code).
So far I haven't had the need for the C++ API. But DStep doesn't support generating bindings for C++ yet so...
 If you asking about actual C/C++ support I have no idea, also dstep is 
 probably can do Objective-C as well (but not this tool), and on average 
 at this moment dstep probably has better C support.
Yes, it can do Objective-C, but not C++ (yet).
 Recently there is also "dpp" showed up, it also seems to do same C API 
 approach as dstep, probably has little-to-none C++ support, might be 
 wrong though. Oh wait, no Windows? nice... But if you only ever do linux 
 stuff and C only then it probably even better choice.
DStep works on Windows these days (compiler from master). -- /Jacob Carlborg
Oct 02 2018
prev sibling parent Atila Neves <atila.neves gmail.com> writes:
On Tuesday, 2 October 2018 at 01:25:10 UTC, evilrat wrote:
 On Monday, 1 October 2018 at 15:35:30 UTC, Stefan Koch wrote:
 On Monday, 1 October 2018 at 13:51:10 UTC, evilrat wrote:
 Hi,
 Early access program is now live!
 Limited offer!
 Preorder until 12.31.2017 BC and you will receive* unique pet 
 - "Cute Space Hamster"!
 !!
 *(Limited quantity in stock)

 [...]
Recently there is also "dpp" showed up, it also seems to do same C API approach as dstep, probably has little-to-none C++ support, might be wrong though. Oh wait, no Windows? nice... But if you only ever do linux stuff and C only then it probably even better choice.
Somebody managed to get dpp compiling on Windows. It's not going to be a lot of work to get it done, it's just not a priority of mine. C++ support is getting there. On Monday I wrote the line `#include <vector>`. It didn't work, but the fact that I even attempted is major progress. C++ is *massive*. And `<vector>` #includes `<type_traits>` which uses pretty much every advanced template feature ever.
Oct 03 2018
prev sibling parent reply Jonathan Marler <johnnymarler gmail.com> writes:
On Monday, 1 October 2018 at 13:51:10 UTC, evilrat wrote:
 Hi,
 Early access program is now live!
 Limited offer!
 Preorder until 12.31.2017 BC and you will receive* unique pet - 
 "Cute Space Hamster"!
 !!
 *(Limited quantity in stock)

 [...]
Based on clang? I approve. I'll have to try it out sometime.
Oct 01 2018
parent evilrat <evilrat666 gmail.com> writes:
On Monday, 1 October 2018 at 15:39:42 UTC, Jonathan Marler wrote:
 On Monday, 1 October 2018 at 13:51:10 UTC, evilrat wrote:
 Hi,
 Early access program is now live!
 Limited offer!
 Preorder until 12.31.2017 BC and you will receive* unique pet 
 - "Cute Space Hamster"!
 !!
 *(Limited quantity in stock)

 [...]
Based on clang? I approve. I'll have to try it out sometime.
To be precise it is based on clang libtooling API, and not the clang itself, it does not implements or extends the compiler, but uses its reach API's for handle stuff. Sorry for a poor misleading wording.
Oct 01 2018