digitalmars.D - D libraries in other languages
- . . (4/4) Jan 23 2019 C++ is notoriously hard to use with other languages. Is D any
- bauss (6/10) Jan 23 2019 D interfaces directly with C, so no problem there.
- Manu (7/11) Jan 23 2019 Approximately equally challenging as C++.
- Atila Neves (3/18) Jan 24 2019 You automate pretty much all of it:
- Jacob Carlborg (6/10) Jan 24 2019 As others have mentioned, D can interface with C. D can also interface
C++ is notoriously hard to use with other languages. Is D any better? If I made a D library, how easy would it be to use it in other languages (C, C++, Go, and Rust)?
Jan 23 2019
On Wednesday, 23 January 2019 at 22:25:31 UTC, . . wrote:C++ is notoriously hard to use with other languages. Is D any better? If I made a D library, how easy would it be to use it in other languages (C, C++, Go, and Rust)?D interfaces directly with C, so no problem there. As far as C++ it should work just as well, there are only a very few quirks with that. Anything that can interface to C can interface just as easily to D.
Jan 23 2019
On Wed, Jan 23, 2019 at 2:30 PM . . via Digitalmars-d <digitalmars-d puremagic.com> wrote:C++ is notoriously hard to use with other languages. Is D any better? If I made a D library, how easy would it be to use it in other languages (C, C++, Go, and Rust)?Approximately equally challenging as C++. You basically depend on `extern(C)`. In D you may gain one substantial advantage, in that you might create a system to automatically wrap the D-facing API in `extern(C)` export shims. So perhaps you can automate a lot of `extern(C)` boilerplate...
Jan 23 2019
On Thursday, 24 January 2019 at 04:37:06 UTC, Manu wrote:On Wed, Jan 23, 2019 at 2:30 PM . . via Digitalmars-d <digitalmars-d puremagic.com> wrote:You automate pretty much all of it: https://github.com/kaleidicassociates/autowrapC++ is notoriously hard to use with other languages. Is D any better? If I made a D library, how easy would it be to use it in other languages (C, C++, Go, and Rust)?Approximately equally challenging as C++. You basically depend on `extern(C)`. In D you may gain one substantial advantage, in that you might create a system to automatically wrap the D-facing API in `extern(C)` export shims. So perhaps you can automate a lot of `extern(C)` boilerplate...
Jan 24 2019
On 2019-01-23 23:25, .. wrote:C++ is notoriously hard to use with other languages. Is D any better? If I made a D library, how easy would it be to use it in other languages (C, C++, Go, and Rust)?As others have mentioned, D can interface with C. D can also interface with C++ and with Objective-C. It depends on which language you want to interface with, you mentioned C++. -- /Jacob Carlborg
Jan 24 2019