Re: betterC examples?

2021-05-01 Thread sfp via Digitalmars-d-learn
On Saturday, 1 May 2021 at 01:52:00 UTC, Mike Parker wrote: ... Mike, thanks for your detailed replies. They're both very helpful. What you described is what I figured I would need to do if I were to roll my own solution. I was hoping someone would have gone through the trouble of doing this

Re: betterC examples?

2021-04-30 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 1 May 2021 at 01:29:05 UTC, Mike Parker wrote: As for the code, your main function should be `extern(C)`. Functions you want to make available to the C side should also be `extern(C)`, and will need equivalent declarations in C. DMD has an experimental feature to generate C head

Re: betterC examples?

2021-04-30 Thread Mike Parker via Digitalmars-d-learn
On Friday, 30 April 2021 at 22:22:05 UTC, sfp wrote: To be clear, I'm mostly interested in examples that show how to structure a project. I'd like to know what the best way to start using D in my current project is, how to call D from C, and how to call C from D. There is nothing special

Re: betterC examples?

2021-04-30 Thread Alain De Vos via Digitalmars-d-learn
https://dlang.org/spec/interfaceToC.html

Re: betterC examples?

2021-04-30 Thread sfp via Digitalmars-d-learn
On Friday, 30 April 2021 at 23:06:48 UTC, bachmeier wrote: There is a blog series https://dlang.org/blog/the-d-and-c-series/#betterC Thanks for the link. I read through these, but they don't address my question. The first two posts are about specific -betterC features and the third one is ab

Re: betterC examples?

2021-04-30 Thread bachmeier via Digitalmars-d-learn
On Friday, 30 April 2021 at 22:22:05 UTC, sfp wrote: I'm developing a C library with Cython bindings, built using CMake. I'd like to use D with -betterC to write some new code where it would be handy to have access to some more advanced language features to keep things readable. For my domain,

betterC examples?

2021-04-30 Thread sfp via Digitalmars-d-learn
ewriting a bunch of C code that's already tested and works nicely isn't a priority for me. I would like to develop new "modules" using -betterC and freely mix them into my existing C code without it being a headache. So, it would be helpful to see some real -betterC examples