Jump to page: 1 2
Thread overview
Oh My Gentool [v0.0.1] (Yet another binding generator)
Oct 23, 2018
evilrat
Oct 23, 2018
Jacob Carlborg
Oct 23, 2018
evilrat
Oct 23, 2018
12345swordy
Oct 23, 2018
Andrea Fontana
Oct 23, 2018
Atila Neves
Oct 23, 2018
Andrea Fontana
Oct 24, 2018
Jacob Carlborg
Oct 27, 2018
Atila Neves
Oct 28, 2018
evilrat
Oct 23, 2018
Andrea Fontana
October 23, 2018
(Oh My) Gentool v0.0.1 is just released!

What it is?
Binding generator with C/C++ support(primarilly C++) that outputs D bindings.

Internally it is using clang for all heavy lifting work. The code itself is not yet stabilized but is open for everyone to play with or use in just any way possible.

This is the first public "stable" release.


Why?
I just needed something that generates stuff to use C++ libs from D.
Doing this manually is tiresome, so I made this tool to help me automate the process. It is not fully automated, I just use it to generate bulk of the code, and then do necessary fixes and clean-ups here and there.
I know there is already several tools existed, but I don't care much about C(which they DO care) and others proves to be too complicated to set up or use (or both)(esp. on Windows)
It just generates bindings that is available for tools to parse to provide autocompletion.


Target audience?
- Let's be honest - Me, and only me.

But here is who might be interested as well:
- Experienced C++ users who wants to move to D for whatever reason but needs their usual stuff that doesn't have analogs in D. (sorry, but no Boost support and so on)
- Gamedev people?
- Any other users who wants to try this fancy C++ library but lacks C++ skills.
- As for me - I did it to reuse existing gamedev and content pipeline libs, because reimplementing all the stuff in D is not feasible and impractical from maintenance point of view. Not mentioning that not all of them provided with sources.


Limitations?
There are many.
The most important is - It doesn't tries to 'port' STL or BOOST or any other template-only library.
It is targeting D 2.083 with namespaces as string by default, there is no option to generate legacy style namespaces. (ok, there is hacky one, but it is hard coded option)
Not all language contructs are supported, or their support quality is poor.
Now when I added separate preprocessor pass one can enjoy the full genuine C++ compilation speed(lack of), yay \0/


Links:

Sources is available at
https://github.com/Superbelko/ohmygentool

There is few short wiki pages available at
https://github.com/Superbelko/ohmygentool/wiki

This release comes with prebuilt binaries for Linux x64 and Windows x64
https://github.com/Superbelko/ohmygentool/releases

(Since I'm linux noob this linux binaries might be screwed up and just not work at all)
October 23, 2018
On 2018-10-23 09:42, evilrat wrote:

> I know there is already several tools existed, but I don't care much about C(which they DO care)
To be able to handle C++ one needs to be able to handle C. It makes sense to start with C.

-- 
/Jacob Carlborg
October 23, 2018
On Tuesday, 23 October 2018 at 09:25:50 UTC, Jacob Carlborg wrote:
> On 2018-10-23 09:42, evilrat wrote:
>
>> I know there is already several tools existed, but I don't care much about C(which they DO care)
> To be able to handle C++ one needs to be able to handle C. It makes sense to start with C.

I'm sorry if this is confusing. It does handle C as well, it just does so as by-product, and this is not my goal, C++ is.

All I said is that there is tools that does C just fine, it is just C++ that lacks them.

If that's not what you mean can you then explain what is the problem?
October 23, 2018
On Tuesday, 23 October 2018 at 07:42:56 UTC, evilrat wrote:
> (Oh My) Gentool v0.0.1 is just released!
>
> What it is?
> Binding generator with C/C++ support(primarilly C++) that outputs D bindings.
>
> [...]
Don't we have dpp for this?
October 23, 2018
On Tuesday, 23 October 2018 at 14:45:06 UTC, 12345swordy wrote:
> On Tuesday, 23 October 2018 at 07:42:56 UTC, evilrat wrote:
>> (Oh My) Gentool v0.0.1 is just released!
>>
>> What it is?
>> Binding generator with C/C++ support(primarilly C++) that outputs D bindings.
>>
>> [...]
> Don't we have dpp for this?

Not yet :)
October 23, 2018
On Tuesday, 23 October 2018 at 07:42:56 UTC, evilrat wrote:
> (Oh My) Gentool v0.0.1 is just released!
>
> What it is?
> Binding generator with C/C++ support(primarilly C++) that outputs D bindings.


Wow! I tried it and it seems to work, but fails with this:

#include <stddef.h>
void test(char* a = NULL);


it misses NULL macro and generate this:

extern(C++)
void test (char* a = );

Anyway that's a good news for me too!

Andrea


October 23, 2018
On Tuesday, 23 October 2018 at 15:44:06 UTC, Andrea Fontana wrote:
> On Tuesday, 23 October 2018 at 14:45:06 UTC, 12345swordy wrote:
>> On Tuesday, 23 October 2018 at 07:42:56 UTC, evilrat wrote:
>>> (Oh My) Gentool v0.0.1 is just released!
>>>
>>> What it is?
>>> Binding generator with C/C++ support(primarilly C++) that outputs D bindings.
>>>
>>> [...]
>> Don't we have dpp for this?
>
> Not yet :)

We do - it's just very far from being complete. dpp can do some simple C++ and would have been able to do C-with-classes-style C++ ages ago. My focus is on templates though, since for me I can't see any useful C++ libraries that I'd actually want to call from D that don't use templates. And sometimes it's as silly as wanting to bind to an existing not-that-complicated library that happens to have a std::vector in its structs. For that, you need to be able to translate the standard library.

A cursory glance shows me that Oh My Gentool doesn't yet do operator overloading or move/copy constructors yet for instance, and dpp does both of those right now (modulo bugs).

However, the more, the merrier!
October 23, 2018
On Tuesday, 23 October 2018 at 20:03:42 UTC, Atila Neves wrote:
> We do - it's just very far from being complete. dpp can do some simple C++ and would have been able to do C-with-classes-style C++ ages ago. My focus is on templates though, since for me I can't see any useful C++ libraries that I'd actually want to call from D that don't use templates. And sometimes it's as silly as wanting to bind to an existing not-that-complicated library that happens to have a std::vector in its structs. For that, you need to be able to translate the standard library.

Interesting. I'm using it for many different c libraries but I didn't think it worked for c++  already!

The only problem I found with DPP is that simple consts declared with #define are not translated if not explicitly used. I think i can understand the reason (macro evaluation, I guess) but it would be useful to have a way to export them if they are simple consts...
October 24, 2018
On 2018-10-23 22:32, Andrea Fontana wrote:

> Interesting. I'm using it for many different c libraries but I didn't think it worked for c++  already!
> 
> The only problem I found with DPP is that simple consts declared with #define are not translated if not explicitly used. I think i can understand the reason (macro evaluation, I guess) but it would be useful to have a way to export them if they are simple consts...

DStep [1] will do that (build from master). But you might need dpp for different reasons.

[1] http://github.com/jacob-carlborg/dstep

-- 
/Jacob Carlborg
October 27, 2018
On Tuesday, 23 October 2018 at 20:32:29 UTC, Andrea Fontana wrote:
> On Tuesday, 23 October 2018 at 20:03:42 UTC, Atila Neves wrote:
>> We do - it's just very far from being complete. dpp can do some simple C++ and would have been able to do C-with-classes-style C++ ages ago. My focus is on templates though, since for me I can't see any useful C++ libraries that I'd actually want to call from D that don't use templates. And sometimes it's as silly as wanting to bind to an existing not-that-complicated library that happens to have a std::vector in its structs. For that, you need to be able to translate the standard library.
>
> Interesting. I'm using it for many different c libraries but I didn't think it worked for c++  already!
>
> The only problem I found with DPP is that simple consts declared with #define are not translated if not explicitly used. I think i can understand the reason (macro evaluation, I guess) but it would be useful to have a way to export them if they are simple consts...

The whole idea of dpp is to be able to use headers as they are used in C and C++. Macros there don't exist unless they're expanded, so it's the same thing with dpp.

Maybe it's good idea to add a runtime flag to translate non-function-like macros as enums... hmm.
« First   ‹ Prev
1 2