Re: Compililng C++ and D together without going mad

2020-04-29 Thread IGotD- via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 10:25:31 UTC, Jan Hönig wrote: In my pet project, I am using some C++ libraries. The main file/function is also C++. All of it successfully compiles with cmake. Now I want to add some functionality by calling my own D functions (which use some other

Re: Compililng C++ and D together without going mad

2020-04-29 Thread Johan via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 13:02:36 UTC, Jan Hönig wrote: On Wednesday, 29 April 2020 at 11:38:16 UTC, Johan wrote: LDC is a (somewhat complex) project with D and C++ code (and external C++ libraries). I think it will help you if your main() is in D (such that druntime is automatically

Re: Compililng C++ and D together without going mad

2020-04-29 Thread Jan Hönig via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 13:12:50 UTC, Johan wrote: Manually initializing D's runtime is also possible. You need to call rt_init and rt_term: https://dlang.org/phobos/core_runtime.html#.rt_init What I meant is to - add a `int main()` in a D source file - rename your current `main`

Re: Compililng C++ and D together without going mad

2020-04-29 Thread Jan Hönig via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 13:02:36 UTC, Jan Hönig wrote: I will probably need: Also this thing: https://github.com/nlohmann/json

Re: Compililng C++ and D together without going mad

2020-04-29 Thread Jan Hönig via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 11:38:16 UTC, Johan wrote: LDC is a (somewhat complex) project with D and C++ code (and external C++ libraries). I think it will help you if your main() is in D (such that druntime is automatically initialized for you). https://github.com/ldc-developers/ldc

Re: Compililng C++ and D together without going mad

2020-04-29 Thread Johan via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 10:25:31 UTC, Jan Hönig wrote: In my pet project, I am using some C++ libraries. The main file/function is also C++. All of it successfully compiles with cmake. Now I want to add some functionality by calling my own D functions (which use some other