Using the sundials solver package from D - my first experience with importC

Lance Bachmeier no at spam.net
Thu Mar 27 16:03:04 UTC 2025


On Thursday, 27 March 2025 at 14:54:04 UTC, matheus. wrote:
> On Thursday, 27 March 2025 at 14:34:49 UTC, Robert Kovacs wrote:
>> 1. Wrap the necessary headers to `sundials.c`:
>>
>> ..
>>
>> 2. Port the cvRoberts_dns.c example to D:
>>
>> ...
>> 
>> 3. Build:
>>
>> ...
>>
>> 4. Enjoy!
>>
>> This. Is. Amazing.
>>
>> Thank you for all involved in importC development!
>
> Never used importC so pardon my "newbiness".
>
> So you created a "sundials.c" adding all the "*.H" files. Then 
> you just imported that "sundials.c" as
>
> import sundial;
>
> And it worked?
>
> Well this seems very cool.

Yes, it is, considering that most of the C code now compiles 
without problems.

> PS: What would happen if you had sundial.d? The compile can 
> resolve two files from different languages?

I don't recall how it's resolved, but you'd still have to add the 
file you need to the command line, so I think it would work. I 
put my C files in their own directory and import from there.


More information about the Digitalmars-d mailing list