Error: out of memory

2017-03-18 Thread StarGrazer via Digitalmars-d-learn
I have some CTFE's and meta programming that cause dmd to run out of memory ;/ I am generating simple classes, but a lot of them. dmd uses about 2GB before it quites. It also only uses about 12% of cpu. I have 16 GB total memory and about that free. Surely dmd could do a better job? Any way

Re: Error: out of memory

2017-03-18 Thread StarGrazer via Digitalmars-d-learn
On Saturday, 18 March 2017 at 20:43:29 UTC, Basile B. wrote: On Saturday, 18 March 2017 at 20:39:20 UTC, StarGrazer wrote: I have some CTFE's and meta programming that cause dmd to run out of memory ;/ I am generating simple classes, but a lot of them. dmd uses about 2GB before it quites. It

How to COM interfaces work

2017-03-18 Thread StarGrazer via Digitalmars-d-learn
I have a COM interface that is dynamically created using invoke and such. One of the functions returns an interface. It is just a value of IUnknown or whatever. If I use it as a pointer in to the the D interface equivalent, it crashes as the value is not pointing to anything valid. What do

Re: How to COM interfaces work

2017-03-18 Thread StarGrazer via Digitalmars-d-learn
On Sunday, 19 March 2017 at 02:45:48 UTC, evilrat wrote: On Sunday, 19 March 2017 at 02:04:53 UTC, StarGrazer wrote: I have a COM interface that is dynamically created using invoke and such. One of the functions returns an interface. It is just a value of IUnknown or whatever. If I use it a

Re: How to COM interfaces work

2017-03-18 Thread StarGrazer via Digitalmars-d-learn
On Sunday, 19 March 2017 at 02:45:48 UTC, evilrat wrote: On Sunday, 19 March 2017 at 02:04:53 UTC, StarGrazer wrote: I have a COM interface that is dynamically created using invoke and such. One of the functions returns an interface. It is just a value of IUnknown or whatever. If I use it a

Re: How to COM interfaces work

2017-03-18 Thread StarGrazer via Digitalmars-d-learn
On Sunday, 19 March 2017 at 03:10:02 UTC, Adam D. Ruppe wrote: On Sunday, 19 March 2017 at 02:04:53 UTC, StarGrazer wrote: If I use it as a pointer in to the the D interface equivalent, it crashes as the value is not pointing to anything valid. What's the code look like? What interface too?

Issue with typeof

2017-03-20 Thread StarGrazer via Digitalmars-d-learn
typeof(&method) fails unless method is static. Says & requires this. But for typeof, it shouldn't matter and should pass. So how to get a function pointer to a non static member function(of an interface)? I've tried creating the type like T t; typeof(&t.method) fptr; but same issue. It may

Re: Issue with typeof

2017-03-20 Thread StarGrazer via Digitalmars-d-learn
On Monday, 20 March 2017 at 18:27:39 UTC, Moritz Maxeiner wrote: On Monday, 20 March 2017 at 17:58:32 UTC, Moritz Maxeiner wrote: [...] This may sound harder that it is, btw. A template that does exactly that is the following (template constraints that verify `method` to actually be a membe

Re: Issue with typeof

2017-03-21 Thread StarGrazer via Digitalmars-d-learn
On Tuesday, 21 March 2017 at 15:01:43 UTC, ag0aep6g wrote: On 03/20/2017 05:55 PM, StarGrazer wrote: typeof(&method) fails unless method is static. Says & requires this. Works for me: class C { void method() {} typeof(&method) x; } typeof(&C.method) y; Tested with dmd 2.073

how to test if member of instance exists/defined?

2017-03-22 Thread StarGrazer via Digitalmars-d-learn
I've tried compiles but I guess that only checks if the code has valid syntax, not if it actually will compile in context.

Re: how to test if member of instance exists/defined?

2017-03-22 Thread StarGrazer via Digitalmars-d-learn
On Wednesday, 22 March 2017 at 20:53:17 UTC, crimaniak wrote: On Wednesday, 22 March 2017 at 20:35:27 UTC, StarGrazer wrote: I've tried compiles but I guess that only checks if the code has valid syntax, not if it actually will compile in context. https://dlang.org/spec/traits.html#hasMember

Re: how to test if member of instance exists/defined?

2017-03-22 Thread StarGrazer via Digitalmars-d-learn
On Wednesday, 22 March 2017 at 21:02:41 UTC, StarGrazer wrote: On Wednesday, 22 March 2017 at 20:53:17 UTC, crimaniak wrote: On Wednesday, 22 March 2017 at 20:35:27 UTC, StarGrazer wrote: I've tried compiles but I guess that only checks if the code has valid syntax, not if it actually will comp

Re: how to test if member of instance exists/defined?

2017-03-22 Thread StarGrazer via Digitalmars-d-learn
On Wednesday, 22 March 2017 at 21:04:48 UTC, StarGrazer wrote: On Wednesday, 22 March 2017 at 21:02:41 UTC, StarGrazer wrote: On Wednesday, 22 March 2017 at 20:53:17 UTC, crimaniak wrote: On Wednesday, 22 March 2017 at 20:35:27 UTC, StarGrazer wrote: I've tried compiles but I guess that only ch

Re: 'fopen64 cannot be interpreted at compile time' for __gshared File

2017-03-25 Thread StarGrazer via Digitalmars-d-learn
On Saturday, 25 March 2017 at 16:46:00 UTC, crimaniak wrote: On Saturday, 25 March 2017 at 16:08:49 UTC, NotSpooky wrote: __gshared implies static,... Thanks! Confusing for me moment. try this: import std.stdio; void main() { import std.stdio; __gshared File f;