Re: Accessing COM Objects

2016-06-12 Thread Mike Parker via Digitalmars-d-learn
On Monday, 13 June 2016 at 04:52:49 UTC, Mike Parker wrote: On Monday, 13 June 2016 at 02:08:22 UTC, Incognito wrote: What interface are you talking about? How can I cast to something I don't have? I do not have a photoshop COM interface. Are you saying that if CoCreateInstance worked that I

Re: Accessing COM Objects

2016-06-12 Thread Mike Parker via Digitalmars-d-learn
On Monday, 13 June 2016 at 02:08:22 UTC, Incognito wrote: What interface are you talking about? How can I cast to something I don't have? I do not have a photoshop COM interface. Are you saying that if CoCreateInstance worked that I can then use the iid or pUnk to access the COM? Do I get the

Re: Fibers, what for?

2016-06-12 Thread Ali Çehreli via Digitalmars-d-learn
On 06/12/2016 07:19 PM, Patric Dexheimer wrote: On Monday, 13 June 2016 at 00:57:11 UTC, Alex Parrill wrote: Also note that Vibe.d, the largest fiber-based framework D has to offer, is capable of running several coroutines in parallel on multiple threads, meaning you must use the same level of

Re: Constraining template with function signature

2016-06-12 Thread Carl Vogel via Digitalmars-d-learn
On Thursday, 9 June 2016 at 19:08:52 UTC, cy wrote: But it's probably clearer to use that is(typeof({ how this function will be called })) trick. A very delayed thanks to both of you. It does seem like it would be useful to have something like a hasSignature!(Fun, Ret, Args...) defined in

Re: Fibers, what for?

2016-06-12 Thread Patric Dexheimer via Digitalmars-d-learn
On Monday, 13 June 2016 at 00:57:11 UTC, Alex Parrill wrote: Also note that Vibe.d, the largest fiber-based framework D has to offer, is capable of running several coroutines in parallel on multiple threads, meaning you must use the same level of synchronization as if you were using threads.

Re: Accessing COM Objects

2016-06-12 Thread Incognito via Digitalmars-d-learn
On Monday, 13 June 2016 at 01:52:12 UTC, Mike Parker wrote: On Monday, 13 June 2016 at 01:22:33 UTC, Incognito wrote: I can do this stuff in C# by simply dragging and dropping a dll into the references and it works fine but is a bit slow. I was hoping I could speed things up using D but it

Re: Accessing COM Objects

2016-06-12 Thread Mike Parker via Digitalmars-d-learn
On Monday, 13 June 2016 at 01:22:33 UTC, Incognito wrote: I can do this stuff in C# by simply dragging and dropping a dll into the references and it works fine but is a bit slow. I was hoping I could speed things up using D but it seems like COM isn't really supported, despite what several

Re: Gotchas for returning values from blocks

2016-06-12 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 12 June 2016 at 18:24:58 UTC, jmh530 wrote: garbage collected variable and assign it to it. Everything seems to work fine. I'm just not sure if there are any gotchas to be aware of. class Foo { int baz = 2; } void main() { import std.stdio : writeln;

Accessing COM Objects

2016-06-12 Thread Incognito via Digitalmars-d-learn
I've been reading over D's com and can't find anything useful. It seems there are different ways: http://www.lunesu.com/uploads/ModernCOMProgramminginD.pdf which is of no help and requires an idl file, which I don't have. Then theres this http://wiki.dlang.org/COM_Programming which is also

Re: Fibers, what for?

2016-06-12 Thread Alex Parrill via Digitalmars-d-learn
On Sunday, 12 June 2016 at 08:38:03 UTC, chmike wrote: Fibers don't need synchronization to access shared data. This removes the overhead of synchronization and simplifies "multitheaded" programming greatly. This is misleading. Any sort of cooperative system needs synchronization when two or

Re: An Alternative to Deimos' OpenSSL Bindings

2016-06-12 Thread David Nadlinger via Digitalmars-d-learn
On Sunday, 12 June 2016 at 21:49:21 UTC, Vladimir Panteleev wrote: On Sunday, 12 June 2016 at 19:12:37 UTC, Meta wrote: I wanted to use OpenSSL from D but I noticed that the Deimos bindings are for version 1.0.0e, which according to OpenSSL.org is an out of date version. Are there any bindings

Re: Creating a reference counted type?

2016-06-12 Thread Gary Willoughby via Digitalmars-d-learn
On Sunday, 12 June 2016 at 15:05:53 UTC, ketmar wrote: this is basically how refcounted structs are done. note that i just typed the code into reply box, so it may not compile or contain some small bugs, but i think you got the idea. Thanks for the replies guys.

Re: An Alternative to Deimos' OpenSSL Bindings

2016-06-12 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 12 June 2016 at 19:12:37 UTC, Meta wrote: I wanted to use OpenSSL from D but I noticed that the Deimos bindings are for version 1.0.0e, which according to OpenSSL.org is an out of date version. Are there any bindings for the latest version, or an alternative that I could use? I know

Re: An Alternative to Deimos' OpenSSL Bindings

2016-06-12 Thread Peter Lewis via Digitalmars-d-learn
On Sunday, 12 June 2016 at 19:12:37 UTC, Meta wrote: I wanted to use OpenSSL from D but I noticed that the Deimos bindings are for version 1.0.0e, which according to OpenSSL.org is an out of date version. Are there any bindings for the latest version, or an alternative that I could use? I know

Re: Gotchas for returning values from blocks

2016-06-12 Thread jmh530 via Digitalmars-d-learn
On Sunday, 12 June 2016 at 19:30:49 UTC, Era Scarecrow wrote: On Sunday, 12 June 2016 at 18:24:58 UTC, jmh530 wrote: I'm just not sure if there are any gotchas to be aware of. Aside from forgetting it's it's own block, you might add a return statement to it and leave the entire function. Or

Re: Gotchas for returning values from blocks

2016-06-12 Thread Era Scarecrow via Digitalmars-d-learn
On Sunday, 12 June 2016 at 18:24:58 UTC, jmh530 wrote: I'm just not sure if there are any gotchas to be aware of. Aside from forgetting it's it's own block, you might add a return statement to it and leave the entire function. Or forget what's in what scope (assuming you do more than 1-2

An Alternative to Deimos' OpenSSL Bindings

2016-06-12 Thread Meta via Digitalmars-d-learn
I wanted to use OpenSSL from D but I noticed that the Deimos bindings are for version 1.0.0e, which according to OpenSSL.org is an out of date version. Are there any bindings for the latest version, or an alternative that I could use? I know I could use std.digest for SHA512, but I still need

Gotchas for returning values from blocks

2016-06-12 Thread jmh530 via Digitalmars-d-learn
I was thinking about how Rust can return arbitrarily from blocks. It occurred to me recently that there's no reason you can't do that in D. I'm just not sure if there are any limitations. For instance, in the code below, I create an object but don't allocate anything, then in a block I create

Re: Creating a reference counted type?

2016-06-12 Thread ZombineDev via Digitalmars-d-learn
On Sunday, 12 June 2016 at 14:49:18 UTC, Gary Willoughby wrote: On Sunday, 12 June 2016 at 14:45:12 UTC, ketmar wrote: ahem... wut?! we have one copy of our struct freed half the way, and another copy has refcount of 2, so it won't be freed at all. it doesn't so innocent as it looks: we may

Re: Creating a reference counted type?

2016-06-12 Thread ketmar via Digitalmars-d-learn
On Sunday, 12 June 2016 at 14:49:18 UTC, Gary Willoughby wrote: Hmmm. I thought it looked *too* simple. Have you any idea if there is a simple solution to this? yes. you have to turn your refcount to pointer. ;-) the cause of "misbehave" is the fact that there can exist several copies of the

Re: Creating a reference counted type?

2016-06-12 Thread Gary Willoughby via Digitalmars-d-learn
On Sunday, 12 June 2016 at 14:45:12 UTC, ketmar wrote: ahem... wut?! we have one copy of our struct freed half the way, and another copy has refcount of 2, so it won't be freed at all. it doesn't so innocent as it looks: we may try to use `f` in `main`... just to find out that resources was

Re: Creating a reference counted type?

2016-06-12 Thread ketmar via Digitalmars-d-learn
this won't work at all. let's insert `writeln("FREE!");` in dtor, and test it: auto foo (Foo foo) { version(dump) writeln(foo._refCount); return foo; } void main () { auto f = foo(Foo()); version(dump) writeln(f._refCount); } it prints "FREE" once, so it looks like the whole thing is

Re: Creating a reference counted type?

2016-06-12 Thread Gary Willoughby via Digitalmars-d-learn
On Sunday, 12 June 2016 at 14:29:19 UTC, Gary Willoughby wrote: Another thing that is puzzling me is that when creating an instance of the above struct and passing as an argument to a function, the copy constructor is called and the reference count is incremented. This is expected. However,

Creating a reference counted type?

2016-06-12 Thread Gary Willoughby via Digitalmars-d-learn
I'm wondering if it's this easy to create a reference counted type: struct Foo { int _refCount = 1; this(...) { // allocate resources, etc. } this(this) { this._refCount++; } ~this() {

Re: How to detect/filter modules in __traits(allMembers)?

2016-06-12 Thread Random D user via Digitalmars-d-learn
On Saturday, 11 June 2016 at 20:30:47 UTC, Basile B. wrote: On Saturday, 11 June 2016 at 19:45:56 UTC, Random D user wrote: Any good ideas how to do that? I couldn't figure it out in a short amount of time, but I expect that it's possible. I'm probably missing something obvious here.

Re: What's up with GDC?

2016-06-12 Thread Joerg Joergonson via Digitalmars-d-learn
On Sunday, 12 June 2016 at 13:23:26 UTC, Adam D. Ruppe wrote: On Sunday, 12 June 2016 at 13:05:48 UTC, Joerg Joergonson wrote: BTW, when I compile a simple project with your simpledisplay it takes up around 300MB(for ldc, 400 for dmd) and uses about 15% cpu. What's your code? The library

Re: What's up with GDC?

2016-06-12 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 12 June 2016 at 13:05:48 UTC, Joerg Joergonson wrote: BTW, when I compile a simple project with your simpledisplay it takes up around 300MB(for ldc, 400 for dmd) and uses about 15% cpu. What's your code? The library itself does fairly little so the time probably depends on your

Re: What's up with GDC?

2016-06-12 Thread Joerg Joergonson via Digitalmars-d-learn
On Sunday, 12 June 2016 at 09:11:09 UTC, Johan Engelen wrote: On Sunday, 12 June 2016 at 04:19:33 UTC, Joerg Joergonson wrote: Here are the versions The one that isn't working: LDC - the LLVM D compiler (30b1ed): based on DMD v2.071.1 and LLVM 3.9.0git-d06ea8a built with LDC - the LLVM D

Re: What's up with GDC?

2016-06-12 Thread Joerg Joergonson via Digitalmars-d-learn
On Sunday, 12 June 2016 at 12:38:25 UTC, Adam D. Ruppe wrote: On Sunday, 12 June 2016 at 04:19:33 UTC, Joerg Joergonson wrote: 2. I got an error that I don't get with dmd: Error: incompatible types for ((ScreenPainter) !is (null)): cannot use '!is' with types and I have defined

Re: What's up with GDC?

2016-06-12 Thread Joerg Joergonson via Digitalmars-d-learn
On Sunday, 12 June 2016 at 05:08:12 UTC, Mike Parker wrote: On Sunday, 12 June 2016 at 04:19:33 UTC, Joerg Joergonson wrote: 1. I had an older distro(I think) of ldc. The ldc2.exe is 18MB while the "new" one is 36MB. I copied the old ldc bin dir to the new one and didn't change anything and

Re: What's up with GDC?

2016-06-12 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 12 June 2016 at 04:19:33 UTC, Joerg Joergonson wrote: 2. I got an error that I don't get with dmd: Error: incompatible types for ((ScreenPainter) !is (null)): cannot use '!is' with types and I have defined ScreenPainter in my code. It is also in arsd's simpledisplay. I do not

Re: Why can't I assign a mixin to an alias?

2016-06-12 Thread Dechcaudron via Digitalmars-d-learn
On Saturday, 11 June 2016 at 01:53:10 UTC, David Nadlinger wrote: This might be a gratuitous grammar restriction. There are a few of those surrounding alias "targets". A template that simply returns its parameter might work, though, such as std.meta.Alias (alias foo = Alias!(mixin(…));). It

Re: What's up with GDC?

2016-06-12 Thread Johan Engelen via Digitalmars-d-learn
On Sunday, 12 June 2016 at 04:19:33 UTC, Joerg Joergonson wrote: Here are the versions The one that isn't working: LDC - the LLVM D compiler (30b1ed): based on DMD v2.071.1 and LLVM 3.9.0git-d06ea8a built with LDC - the LLVM D compiler (1.0.0) Default target: x86_64-pc-windows-msvc

Re: What's up with GDC?

2016-06-12 Thread Johan Engelen via Digitalmars-d-learn
On Sunday, 12 June 2016 at 04:19:33 UTC, Joerg Joergonson wrote: So ldc parses things differently than dmd... I imagine this is a bug! That, or you are comparing different D language versions. The D language is evolving: different DMD compiler versions may treat the same code differently.

Re: What's up with GDC?

2016-06-12 Thread Johan Engelen via Digitalmars-d-learn
On Sunday, 12 June 2016 at 03:11:14 UTC, Mike Parker wrote: On Sunday, 12 June 2016 at 01:51:05 UTC, Joerg Joergonson wrote: DMD works fine BTW. GDC and LDC should be a drop in replacement. Not a totally new setup that has it's own set of problems. I'm sure I'm not the only one put off by

Re: Fibers, what for?

2016-06-12 Thread chmike via Digitalmars-d-learn
On Sunday, 12 June 2016 at 05:11:57 UTC, Ali Çehreli wrote: For convenience, here's the link: http://www.ustream.tv/recorded/86352137/highlight/699197 unfortunately iPads are not supported to view the video. :( I see two major benefits of fibers overs threads. Fibers don't need