Is it possible to translate this API's C headers?

Mike Parker aldacron at gmail.com
Mon Sep 17 06:49:08 UTC 2018


On Monday, 17 September 2018 at 03:16:33 UTC, spikespaz wrote:
> There is a project that I wish to use from D 
> (https://ultralig.ht).
>
> It's Electron, but with forked WebKit and the samples are very, 
> very fast.
>
> This is a great compromise between wanting to have a very 
> custom interface and not wanting to use the slow 
> Electron/Sciter/Awesomium/WebView.
>
> I am having trouble porting the C headers though. Firstly, I 
> barely know C at all, especially not enough to do this. The 
> extent of my C knowledge is terminal TicTacToe game I made 
> three years ago.
>
> I tried using all of the conversion tools under the 
> "Interfacing with C" page of the wiki, but I'm getting import 
> errors. Probably because the paths are all using "<>", 
> expecting an include path from the compiler. I tried to solve 
> this by refractoring the imports to use relative quoted paths.
>
> But even when I fixed that, I kept hitting miscellaneous 
> problems with MSVC, LLVM, and every other dependency under the 
> sun those conversion tools needed. So I figured that Windows 
> was just a crappy ecosystem, and tried it on Linux. No easier.
>
> So now I'm here, a C noob, really wanting to use Adam's great 
> project from the D language. The only barrier is my lack of 
> knowledge in C. And I definitely do not have the means to port 
> these headers by hand.
>
> Could one of you give me pointers about how to go about this? I 
> have the dynamic link libraries, the static libraries, and the 
> header includes.
>
> https://github.com/ultralight-ux/ultralight
> https://github.com/ultralight-ux/ultralight-0.9-api

FYI, those are C++ headers, not C. The page you read will get you 
part of the way there, but the Interfacing to C++ page would be 
more relevant:

https://dlang.org/spec/cpp_interface.html

Of course, if you don't know C++ that will only get you so far. 
If these were C headers, I'd just go ahead and translate them 
myself, but C++ headers will require a higher time investment 
from me because I'm not up to speed on the current state of D's 
C++ interface. There are people here who are more well informed 
who might be able to help, but it's going to require more than a 
few tips in a forum post.


More information about the Digitalmars-d-learn mailing list