Re: Memory management by interfacing C/C++

2019-04-28 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 28 April 2019 at 23:10:24 UTC, Ferhat Kurtulmuş wrote: You are right. I am rewriting the things using mallocs, and will use core.stdc.stdlib.free on d side. I am not sure if I can use core.stdc.stdlib.free to destroy arrays allocated with new op. core.stdc.stdlib.free is (as the

Re: Memory management by interfacing C/C++

2019-04-28 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 28 April 2019 at 03:54:17 UTC, Paul Backus wrote: On Saturday, 27 April 2019 at 22:25:58 UTC, Ferhat Kurtulmuş wrote: Hi, I am wrapping some C++ code for my personal project (opencvd), and I am creating so many array pointers at cpp side and containing them in structs. I want to

Re: Determime actual modules used

2019-04-28 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 28 April 2019 at 22:02:45 UTC, Alex wrote: Any utility exists to do this? I don't know if there's a utility, but the way I'd do it is to simply replace a module with an empty one, recompile, and see if it still builds. Repeat for each module. Should be reasonably easily

Determime actual modules used

2019-04-28 Thread Alex via Digitalmars-d-learn
I need to determine the actual modules that are used in the project, not just imported but ones that actually are referenced. Any utility exists to do this?

Re: Passing a pointer to a function (by value) changes the pointer value

2019-04-28 Thread Stefanos Baziotis via Digitalmars-d-learn
On Sunday, 28 April 2019 at 18:48:55 UTC, Adam D. Ruppe wrote: Sounds like you have a stack corruption bug somewhere else... memory being overwritten by something else. Can you post any more of the context code? I fixed it, there was a bug, but not related to stack. Not related to memory

Re: Passing a pointer to a function (by value) changes the pointer value

2019-04-28 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 28 April 2019 at 18:16:24 UTC, Stefanos Baziotis wrote: In the debugger, before calling 'foo', 't' had a value (an address) let's say 10. Stepping into 'foo', the 't' that 'foo' got, which is supposed to have the same value that the 't' in 'bar' had, actually had a completely

Passing a pointer to a function (by value) changes the pointer value

2019-04-28 Thread Stefanos Baziotis via Digitalmars-d-learn
Hello everyone, I have a function: void foo(T *t) { ... } void bar(...) { T *t = ...; foo(t); } In the debugger, before calling 'foo', 't' had a value (an address) let's say 10. Stepping into 'foo', the 't' that 'foo' got, which is supposed to have the same value that the 't' in

Re: Packages / imports & references between modules

2019-04-28 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-04-28 16:18:59 +, kdevel said: This compiles with dmd v2.085.1: $ cat A/a.d module A.a; import A.b; $ cat A/b.d module A.b; struct myStruct { int i; } $ cat A/c.d module A.c; import A.a; import A.b; struct myOtherStruct { myStruct ms; } void main () { import

Re: Packages / imports & references between modules

2019-04-28 Thread kdevel via Digitalmars-d-learn
On Sunday, 28 April 2019 at 14:24:08 UTC, Robert M. Münch wrote: On 2019-04-28 11:44:03 +, Mike Parker said: They're different symbols because they're in different modules. The module and package name is part of the symbol name. Ok, that's what I assumed too. Just import A.b in A.a.

Re: Packages / imports & references between modules

2019-04-28 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-04-28 11:44:03 +, Mike Parker said: They're different symbols because they're in different modules. The module and package name is part of the symbol name. Ok, that's what I assumed too. Just import A.b in A.a. Won't help. I just commented the lines DStep generated for

Re: Packages / imports & references between modules

2019-04-28 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 28 April 2019 at 11:12:50 UTC, Robert M. Münch wrote: One more problem now showing up, when I do this: A/a.d module A.a; struct myStruct; A/b.d module A.b; struct myStruct {...} A/c.d module A.c; import A; struct

Re: Packages / imports & references between modules

2019-04-28 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-04-27 16:30:48 +, Adam D. Ruppe said: This will never work in D. The module needs to work by itself. It can see public imports from another module it itself imports: module A.c; import A; // thanks to this, it can see a `public import A.a;` from the A package.. But without

Re: Packages / imports & references between modules

2019-04-28 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-04-27 16:30:48 +, Adam D. Ruppe said: There is no "same level" really (except for the `package` protection level); it is just inside the module or outside the module for imports. Hi Adamn, ok, got it. The docs are indicating that the "public import" is only working along the