Re: prolog and epilog code

2016-08-02 Thread Rufus Smith via Digitalmars-d-learn
On Tuesday, 2 August 2016 at 20:28:51 UTC, Rufus Smith wrote: On Tuesday, 2 August 2016 at 18:34:49 UTC, Steven Schveighoffer wrote: On 8/2/16 2:25 PM, Rufus Smith wrote: So, something funky is going on. Any ideas? phobos is not being resolved. I don't use visualD, so I'm not sure what the

Re: prolog and epilog code

2016-08-02 Thread Rufus Smith via Digitalmars-d-learn
On Tuesday, 2 August 2016 at 18:34:49 UTC, Steven Schveighoffer wrote: On 8/2/16 2:25 PM, Rufus Smith wrote: So, something funky is going on. Any ideas? phobos is not being resolved. I don't use visualD, so I'm not sure what the issue is, it's probably a compiler or linker ordering issue.

Re: prolog and epilog code

2016-08-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/2/16 2:25 PM, Rufus Smith wrote: So, something funky is going on. Any ideas? phobos is not being resolved. I don't use visualD, so I'm not sure what the issue is, it's probably a compiler or linker ordering issue. -Steve

Re: prolog and epilog code

2016-08-02 Thread Rufus Smith via Digitalmars-d-learn
On Tuesday, 2 August 2016 at 17:25:21 UTC, Steven Schveighoffer wrote: On 8/2/16 1:04 PM, Rufus Smith wrote: On Tuesday, 2 August 2016 at 16:30:08 UTC, Adam D. Ruppe wrote: On Tuesday, 2 August 2016 at 16:21:07 UTC, Rufus Smith wrote: How does one use C main? extern C? extern(C) int main()

Re: prolog and epilog code

2016-08-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/2/16 1:26 PM, Adam D. Ruppe wrote: On Tuesday, 2 August 2016 at 17:23:57 UTC, Adam D. Ruppe wrote: _d_run_main is extern(C), not just extern. Then your code should work. Also, you don't actually have to rt_init and rt_term if you do _d_run_main because it does it for you... I don't

Re: prolog and epilog code

2016-08-02 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 2 August 2016 at 17:23:57 UTC, Adam D. Ruppe wrote: _d_run_main is extern(C), not just extern. Then your code should work. Also, you don't actually have to rt_init and rt_term if you do _d_run_main because it does it for you...

Re: prolog and epilog code

2016-08-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/2/16 1:04 PM, Rufus Smith wrote: On Tuesday, 2 August 2016 at 16:30:08 UTC, Adam D. Ruppe wrote: On Tuesday, 2 August 2016 at 16:21:07 UTC, Rufus Smith wrote: How does one use C main? extern C? extern(C) int main() should do it It doesn't seem to be that easy!

Re: prolog and epilog code

2016-08-02 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 2 August 2016 at 17:04:08 UTC, Rufus Smith wrote: It doesn't seem to be that easy! _d_run_main is extern(C), not just extern. Then your code should work. You can also simplify more: --- import std.stdio; import core.runtime; extern(C) int main() { rt_init();

Re: prolog and epilog code

2016-08-02 Thread Rufus Smith via Digitalmars-d-learn
On Tuesday, 2 August 2016 at 16:30:08 UTC, Adam D. Ruppe wrote: On Tuesday, 2 August 2016 at 16:21:07 UTC, Rufus Smith wrote: How does one use C main? extern C? extern(C) int main() should do it It doesn't seem to be that easy! https://wiki.dlang.org/Runtime_internals If I do this then I

Re: prolog and epilog code

2016-08-02 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 2 August 2016 at 16:21:07 UTC, Rufus Smith wrote: How does one use C main? extern C? extern(C) int main() should do it

Re: prolog and epilog code

2016-08-02 Thread Rufus Smith via Digitalmars-d-learn
On Tuesday, 2 August 2016 at 11:37:05 UTC, Steven Schveighoffer wrote: On 8/1/16 9:24 PM, Rufus Smith wrote: Can one add code that executes before the GC and any memory is normally allocated(even static) and after all of it was suppose to be released? Of course! You just have to modify

Re: prolog and epilog code

2016-08-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/1/16 9:24 PM, Rufus Smith wrote: Can one add code that executes before the GC and any memory is normally allocated(even static) and after all of it was suppose to be released? Of course! You just have to modify druntime :) One thing you can do instead is compile without a D main

prolog and epilog code

2016-08-01 Thread Rufus Smith via Digitalmars-d-learn
Can one add code that executes before the GC and any memory is normally allocated(even static) and after all of it was suppose to be released? A sort of static this for the whole app. I would like to monitor the memory of the app to make sure that the total memory before and after is equal.