importC to bindings via -Hf=your.di intermediate ?

Bruce Carneal bcarneal at gmail.com
Sun Sep 10 05:15:59 UTC 2023


On Sunday, 10 September 2023 at 01:45:58 UTC, Adam Wilson wrote:
> On Wednesday, 6 September 2023 at 01:14:47 UTC, Bruce Carneal 
> wrote:
...
>>> On Wednesday, 6 September 2023 at 00:53:40 UTC, Bruce Carneal 
>>> wrote:
>>>> ...
>>>> I will note that I've had some luck using importC directly, 
>>>> with a little fiddling, ...
>>
>> Here "some work" may actually be a Herculean challenge but I 
>> think not since the errors all seem to be of the form: "the 
>> information is in the compiler but was not processed properly 
>> for -Hf".
>>
>> In any event, commentary from those in the know would be most 
>> appreciated.
>
> I am using this process to update the ODBC bindings in 
> etc.c.odbc, however, I currently have two active bugs against 
> ImportC because when I try to generate a DI binding from an H 
> file that has an tagged enum in it I get a segfault. But if you 
> comment out the offending bits it actually works pretty much as 
> you'd expect.

Good to hear.  I'll look at the -Hf path again down the road but 
went back to using importC directly for #include <cuda.h> 
bindings.  Everything works AFAICT from my testing apart from 
importC ignoring #defines that should be function aliases for 
functions being declared elsewhere in the file, as in:

#define someStableFuncName 
actualFuncNameOfFunctionDefinedInThisFile
...

I'm not sure where I should report this "bug" in importC or even 
if it is considered a bug, but I've worked around it with a 
simple helper program, importC having done the heavy lifting.



More information about the Digitalmars-d mailing list