Re: C++ interface vs D and com

2016-07-14 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 21:27:29 UTC, Adam Sansier wrote: Yes! your right, If you were only around to tell me that in the first place! ;) Now we know. Again, as I said before, the problem is informational. We know it only after you posted links to threads with relevant info. You knew th

Re: C++ interface vs D and com

2016-07-13 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 21:27:29 UTC, Adam Sansier wrote: Yes! your right, If you were only around to tell me that in the first place! ;) Now we know. Again, as I said before, the problem is informational. Maybe because come works 99% of the time doesn't help us in the 1% if some think

Re: C++ interface vs D and com

2016-07-13 Thread Adam Sansier via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 20:47:21 UTC, John wrote: On Wednesday, 13 July 2016 at 20:28:40 UTC, Adam Sansier wrote: On Wednesday, 13 July 2016 at 19:22:44 UTC, Kagamin wrote: On Wednesday, 13 July 2016 at 16:48:53 UTC, Adam Sansier wrote: There's a lot of misinformation on the net. Nope,

Re: C++ interface vs D and com

2016-07-13 Thread John via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 20:28:40 UTC, Adam Sansier wrote: On Wednesday, 13 July 2016 at 19:22:44 UTC, Kagamin wrote: On Wednesday, 13 July 2016 at 16:48:53 UTC, Adam Sansier wrote: There's a lot of misinformation on the net. Nope, it's just you. COM support in D and in general works fi

Re: C++ interface vs D and com

2016-07-13 Thread Adam Sansier via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 20:02:50 UTC, Jesse Phillips wrote: On Wednesday, 13 July 2016 at 02:41:22 UTC, Adam Sansier wrote: If you can convince me to try it out, I might... but doing com isn't my primary goal here and I seem to have finished up what I was trying to achieve(my use case is

Re: C++ interface vs D and com

2016-07-13 Thread Adam Sansier via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 19:22:44 UTC, Kagamin wrote: On Wednesday, 13 July 2016 at 16:48:53 UTC, Adam Sansier wrote: There's a lot of misinformation on the net. Nope, it's just you. COM support in D and in general works fine for everyone else. For anyone else having similar problems p

Re: C++ interface vs D and com

2016-07-13 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 02:41:22 UTC, Adam Sansier wrote: If you can convince me to try it out, I might... but doing com isn't my primary goal here and I seem to have finished up what I was trying to achieve(my use case is probably relatively simple though). Last thing I want to do is get

Re: C++ interface vs D and com

2016-07-13 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 16:48:53 UTC, Adam Sansier wrote: There's a lot of misinformation on the net. Nope, it's just you. COM support in D and in general works fine for everyone else.

Re: C++ interface vs D and com

2016-07-13 Thread Adam Sansier via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 08:34:55 UTC, John wrote: On Wednesday, 13 July 2016 at 07:31:57 UTC, Adam Sansier wrote: void** ptr = null; auto res = CoCreateInstance(&CLS_ID, cast(IUnknown)null, CLSCTX_INPROC_SERVER, &CLS_ID, cast(void**)&ptr); How are you casting your "ptr" va

Re: C++ interface vs D and com

2016-07-13 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 07:31:57 UTC, Adam Sansier wrote: void** ptr = null; auto res = CoCreateInstance(&CLS_ID, cast(IUnknown)null, CLSCTX_INPROC_SERVER, &CLS_ID, cast(void**)&ptr); See the example above. IUnknown ptr = null; auto res = CoCreateInstance(&MyCL

Re: C++ interface vs D and com

2016-07-13 Thread John via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 07:31:57 UTC, Adam Sansier wrote: void** ptr = null; auto res = CoCreateInstance(&CLS_ID, cast(IUnknown)null, CLSCTX_INPROC_SERVER, &CLS_ID, cast(void**)&ptr); How are you casting your "ptr" variable (which BTW should be just void* or usually IUnkno

Re: C++ interface vs D and com

2016-07-13 Thread Adam Sansier via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 06:44:36 UTC, Adam Sansier wrote: On Wednesday, 13 July 2016 at 03:38:03 UTC, Mike Parker wrote: On Wednesday, 13 July 2016 at 02:49:54 UTC, Adam Sansier wrote: On Wednesday, 13 July 2016 at 02:34:14 UTC, Mike Parker wrote: What happens when you declare an interf

Re: C++ interface vs D and com

2016-07-13 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 06:44:36 UTC, Adam Sansier wrote: Regardless of what you think, I can prove that the code won't work when it is marked extern(Windows) and works when it is marked extern (C++)... so what you should be asking yourself is why it is doing that rather than assuming I'

Re: C++ interface vs D and com

2016-07-12 Thread Adam Sansier via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 03:38:03 UTC, Mike Parker wrote: On Wednesday, 13 July 2016 at 02:49:54 UTC, Adam Sansier wrote: On Wednesday, 13 July 2016 at 02:34:14 UTC, Mike Parker wrote: What happens when you declare an interface that extends from IUnknown (and not extern(C++)), then cast

Re: C++ interface vs D and com

2016-07-12 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 02:49:54 UTC, Adam Sansier wrote: On Wednesday, 13 July 2016 at 02:34:14 UTC, Mike Parker wrote: What happens when you declare an interface that extends from IUnknown (and not extern(C++)), then cast the pointer returned from the COM API? It should just work with

Re: C++ interface vs D and com

2016-07-12 Thread Adam Sansier via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 02:34:14 UTC, Mike Parker wrote: On Tuesday, 12 July 2016 at 23:55:55 UTC, Adam Sansier wrote: Ok, Another hack: iInterface x; void** y = cast(void**)&x; *y = malloc(iInterface.sizeof);

Re: C++ interface vs D and com

2016-07-12 Thread Adam Sansier via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 02:25:35 UTC, Jesse Phillips wrote: On Tuesday, 12 July 2016 at 15:09:26 UTC, Adam Sansier wrote: So, com throughs me a interface ptr and I need to map it to an interface. When I do, I get an access violation. I have an (com) ptr and an interface. How do I link th

Re: C++ interface vs D and com

2016-07-12 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 23:55:55 UTC, Adam Sansier wrote: Ok, Another hack: iInterface x; void** y = cast(void**)&x; *y = malloc(iInterface.sizeof); x.__vptr = cast(immutable(void*)*)(*ptr); x.

Re: C++ interface vs D and com

2016-07-12 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 15:09:26 UTC, Adam Sansier wrote: So, com throughs me a interface ptr and I need to map it to an interface. When I do, I get an access violation. I have an (com) ptr and an interface. How do I link them up so I can call the functions? I marked the interface extern

Re: C++ interface vs D and com

2016-07-12 Thread Adam Sansier via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 22:55:05 UTC, Adam Sansier wrote: So, the problem now, is how to take the interface, which is simple, no implementation, and either create the implementation or create a sort of simple empty proxy that can be used to instantiate the interface? I mean automaticall

Re: C++ interface vs D and com

2016-07-12 Thread Adam Sansier via Digitalmars-d-learn
So, the problem now, is how to take the interface, which is simple, no implementation, and either create the implementation or create a sort of simple empty proxy that can be used to instantiate the interface? I mean automatically of course. I believe D already has some library solution for

Re: C++ interface vs D and com

2016-07-12 Thread Adam Sansier via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 22:01:41 UTC, Lodovico Giaretta wrote: On Tuesday, 12 July 2016 at 21:21:04 UTC, Adam Sansier wrote: On Tuesday, 12 July 2016 at 15:12:21 UTC, Lodovico Giaretta wrote: I'm not an expert in this field, but did you read this[1]? [1] https://dlang.org/spec/interface.h

Re: C++ interface vs D and com

2016-07-12 Thread Lodovico Giaretta via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 21:21:04 UTC, Adam Sansier wrote: On Tuesday, 12 July 2016 at 15:12:21 UTC, Lodovico Giaretta wrote: I'm not an expert in this field, but did you read this[1]? [1] https://dlang.org/spec/interface.html#com-interfaces Yes, of course... Well, I asked because you s

Re: C++ interface vs D and com

2016-07-12 Thread Adam Sansier via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 15:13:02 UTC, Adam D. Ruppe wrote: On Tuesday, 12 July 2016 at 15:09:26 UTC, Adam Sansier wrote: I marked the interface extern(C++) so it's a C++ style interface. The first field of a COM object is a pointer to its vtable. If it is a COM interface, you should make

Re: C++ interface vs D and com

2016-07-12 Thread Adam Sansier via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 15:12:21 UTC, Lodovico Giaretta wrote: On Tuesday, 12 July 2016 at 15:09:26 UTC, Adam Sansier wrote: So, com throughs me a interface ptr and I need to map it to an interface. When I do, I get an access violation. I have an (com) ptr and an interface. How do I link t

Re: C++ interface vs D and com

2016-07-12 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 15:09:26 UTC, Adam Sansier wrote: I marked the interface extern(C++) so it's a C++ style interface. The first field of a COM object is a pointer to its vtable. If it is a COM interface, you should make it a COM interface by inheriting from IUnknown. http://dlang

Re: C++ interface vs D and com

2016-07-12 Thread Lodovico Giaretta via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 15:09:26 UTC, Adam Sansier wrote: So, com throughs me a interface ptr and I need to map it to an interface. When I do, I get an access violation. I have an (com) ptr and an interface. How do I link them up so I can call the functions? I marked the interface extern