digitalmars.D - Interfacing D with C and Fortran
- data pulverizer (8/8) Apr 04 2017 Hi All,
- jmh530 (17/25) Apr 04 2017 I liked it. Here are my thoughts:
- data pulverizer (13/30) Apr 04 2017 You're right some more explanation here would be useful
- bachmeier (13/21) Apr 04 2017 Unless I missed it, there is no mention of iso_c_binding for
- data pulverizer (4/16) Apr 04 2017 Fair point. I was in two minds about mentioning this because
Hi All, 9il and I have written a D blog article titled "Interfacing D with C and Fortran" which is located here: https://github.com/dataPulverizer/interface-d-c-fortran. We would greatly appreciate feedback from the D community before we publish it. Many thanks in advance. DP
Apr 04 2017
On Tuesday, 4 April 2017 at 13:25:27 UTC, data pulverizer wrote:Hi All, 9il and I have written a D blog article titled "Interfacing D with C and Fortran" which is located here: https://github.com/dataPulverizer/interface-d-c-fortran. We would greatly appreciate feedback from the D community before we publish it. Many thanks in advance. DPI liked it. Here are my thoughts: In some cases, there were bits that I don't follow as well like where you have $ nm example1.o and its results You might want to highlight that betterC is not well documented and provide a few more details on what it means, what are the limitations, etc. You wrote an apply function. Is phobos' map not compatible with betterC? Maybe mention that mir has a map function in ndslice algorithm that could be a betterC alternative. You also discuss template alias parameters when talking about apply. Template aliases seem a bit like magic to me. Sure, I've used them, but still seem like magic. And I don't think the D docs do a great job explaining it. Maybe give a short explanation in addition to what is there (perhaps as a footnote?).
Apr 04 2017
Thanks for the constructive feedback! Glad you liked the article. On Tuesday, 4 April 2017 at 15:40:49 UTC, jmh530 wrote:I liked it. Here are my thoughts: In some cases, there were bits that I don't follow as well like where you have $ nm example1.o and its resultsYou're right some more explanation here would be usefulYou might want to highlight that betterC is not well documented and provide a few more details on what it means, what are the limitations, etc.True, there isn't a lot of material around about this flag and I'd appreciate some more details from those "in the know", 9il knows more about this than I do.You wrote an apply function. Is phobos' map not compatible with betterC? Maybe mention that mir has a map function in ndslice algorithm that could be a betterC alternative.9il and I agreed that we would keep this article dependency free but we can include links to those alternatives.You also discuss template alias parameters when talking about apply. Template aliases seem a bit like magic to me. Sure, I've used them, but still seem like magic. And I don't think the D docs do a great job explaining it. Maybe give a short explanation in addition to what is there (perhaps as a footnote?).Wow a footnote! This might look like a real article :-) That was a joke! We can add a short description with links. I think a detailed article can be written on template alias parameters alone. Thanks a lot for your feedback. It is much appreciated
Apr 04 2017
On Tuesday, 4 April 2017 at 13:25:27 UTC, data pulverizer wrote:Hi All, 9il and I have written a D blog article titled "Interfacing D with C and Fortran" which is located here: https://github.com/dataPulverizer/interface-d-c-fortran. We would greatly appreciate feedback from the D community before we publish it. Many thanks in advance. DPUnless I missed it, there is no mention of iso_c_binding for Fortran. That is worth at least a mention, because - It is documented well and handles many of the underlying details. - It creates a C interface that can then be called from D like a C function. - The target audience of this article includes C programmers already calling into Fortran using iso_c_binding. There's no reason for them to think they have to learn something new to switch to D. I haven't used Fortran in some time, but when I did call it from C, iso_c_binding was very helpful.
Apr 04 2017
On Tuesday, 4 April 2017 at 16:20:56 UTC, bachmeier wrote:Unless I missed it, there is no mention of iso_c_binding for Fortran. That is worth at least a mention, because - It is documented well and handles many of the underlying details. - It creates a C interface that can then be called from D like a C function. - The target audience of this article includes C programmers already calling into Fortran using iso_c_binding. There's no reason for them to think they have to learn something new to switch to D. I haven't used Fortran in some time, but when I did call it from C, iso_c_binding was very helpful.Fair point. I was in two minds about mentioning this because Fortran programmers will already know about it but including it is probably the right thing.
Apr 04 2017