[Issue 21416] betterC mode program with C++ interface fails to link

2022-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
|--- |FIXED --- Comment #3 from Dlang Bot --- dlang/dmd pull request #14075 "Fix Issue 21416 - betterC mode program with C++ interface fails to link" was merged into master: - 2e6ffd14eba3352d36642d8ffab012e8f1787673 by RazvanN7: Fix Issue 21416 - betterC mode program with C++

[Issue 21416] betterC mode program with C++ interface fails to link

2022-05-05 Thread d-bugmail--- via Digitalmars-d-bugs
--- @RazvanN7 created dlang/dmd pull request #14075 "Fix Issue 21416 - betterC mode program with C++ interface fails to link" fixing this issue: - Fix Issue 21416 - betterC mode program with C++ interface fails to link https://github.com/dlang/dmd/pull/14075 --

[Issue 21416] betterC mode program with C++ interface fails to link

2021-08-10 Thread d-bugmail--- via Digitalmars-d-bugs
from Richard Cattermole --- Minified further: extern(C) void main() {} extern(C++) interface IEntry { } extern(C++) class MyEntryInfo : IEntry { } This is known to work for ldc 1.26.0. The __ClassZ error was introduced between dmd 2.094.0 and 2.097.2. --

Re: LNK2019 error in the C++ interface

2021-06-16 Thread dokutoku via Digitalmars-d-learn
On Thursday, 10 June 2021 at 15:19:27 UTC, kinke wrote: Confirmed: https://issues.dlang.org/show_bug.cgi?id=22014 Thank you for the bug report. I'm glad I couldn't handle it myself. The only thing that bothers me is that there is no sign of this problem being fixed. I fear that this may

Re: LNK2019 error in the C++ interface

2021-06-10 Thread kinke via Digitalmars-d-learn
On Thursday, 10 June 2021 at 13:19:34 UTC, dokutoku wrote: The reason seems to be that WCHAR should be mangled with wcha_t, but it is mangled with chat16_t. Confirmed: https://issues.dlang.org/show_bug.cgi?id=22014 Wrt. `tagRECT`, this should come in handy (for a druntime fix):

Re: LNK2019 error in the C++ interface

2021-06-10 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 10 June 2021 at 13:19:34 UTC, dokutoku wrote: I still haven't solved this problem. Not sure if this is the issue, but you don't need `extern` on these. You already have the `extern(C++)` thing at the top of the file. ```d extern void str_test(LPCSTR str1);

Re: LNK2019 error in the C++ interface

2021-06-10 Thread dokutoku via Digitalmars-d-learn
It's been a while since then, but the problem with the structure has been solved. The reason seems to be that the structure name defined in core.sys.windows.windef was not tagRECT. I was able to get it to compile by adding a custom definition as follows ```d extern (C) struct tagRECT {

[Issue 21416] betterC mode program with C++ interface fails to link

2020-11-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21416 Dibyendu Majumdar changed: What|Removed |Added Keywords||betterC, C++ --

[Issue 21416] New: betterC mode program with C++ interface fails to link

2020-11-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21416 Issue ID: 21416 Summary: betterC mode program with C++ interface fails to link Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: major

[Issue 21412] betterC mode program with C++ interface/class crashes

2020-11-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21412 Dibyendu Majumdar changed: What|Removed |Added Status|NEW |RESOLVED Resolution|---

[Issue 21412] betterC mode program with C++ interface/class crashes

2020-11-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21412 --- Comment #4 from Dibyendu Majumdar --- I assume you mean that it needs to be coded like this? import core.stdc.stdio : printf; extern (C++) abstract class A { void sayHello(); } extern (C++) class B : A { override void sayHello() {

[Issue 21412] betterC mode program with C++ interface/class crashes

2020-11-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21412 Adam D. Ruppe changed: What|Removed |Added CC||destructiona...@gmail.com --- Comment #3

[Issue 21412] betterC mode program with C++ interface/class crashes

2020-11-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21412 --- Comment #2 from Dibyendu Majumdar --- I tried with / without @disable this(); Same result --

[Issue 21412] betterC mode program with C++ interface/class crashes

2020-11-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21412 Dibyendu Majumdar changed: What|Removed |Added Keywords||betterC, C++ --- Comment #1 from

[Issue 21412] New: betterC mode program with C++ interface/class crashes

2020-11-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21412 Issue ID: 21412 Summary: betterC mode program with C++ interface/class crashes Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: major

[Issue 20716] Wrong code/ABI for extern(C++) interface method that returns non-POD

2020-11-08 Thread d-bugmail--- via Digitalmars-d-bugs
|--- |FIXED --- Comment #5 from Dlang Bot --- dlang/dmd pull request #11703 "fix Issue 20716 - Wrong code/ABI for extern(C++) interface method tha…" was merged into master: - 9ad79f65edba40925c4f4d92c5603fb5711cd85a by Walter Bright: fix Issue 20716 - Wrong code/ABI fo

How to load a dll which is written by dlang with a c interface from a c program static/dynamic link on windows?

2020-11-06 Thread ll via Digitalmars-d-learn
e.g. mydll.d: import core.sys.windows.windows; import core.sys.windows.dll; extern (C) export int foo(ref int a[10],ref int b[10],ref int c[10]) { for(int i=0;i<10;i++) { c[10]=a[10]-b[10]; } return 0; } mixin SimpleDllMain; test.c: How to write

[Issue 20716] Wrong code/ABI for extern(C++) interface method that returns non-POD

2020-09-07 Thread d-bugmail--- via Digitalmars-d-bugs
--- @WalterBright created dlang/dmd pull request #11703 "fix Issue 20716 - Wrong code/ABI for extern(C++) interface method tha…" fixing this issue: - fix Issue 20716 - Wrong code/ABI for extern(C++) interface method that returns non-POD https://github.com/dlang/dmd/pull/11703 --

[Issue 20716] Wrong code/ABI for extern(C++) interface method that returns non-POD

2020-09-07 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20716 --- Comment #3 from Walter Bright --- The problem here is the "adjustor thunk" generated does not take into account the size of the hidden pointer parameter, and winds up adjusting the hidden pointer rather than the `this` pointer. --

[Issue 20716] Wrong code/ABI for extern(C++) interface method that returns non-POD

2020-09-06 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20716 --- Comment #2 from Walter Bright --- Curiously, this works on Windows. --

LNK2019 error in the C++ interface

2020-09-03 Thread dokutoku via Digitalmars-d-learn
I tried to use a function from a library written in C++ in D. I've been trying to use it in D. But I got an error in LNK2019 and the build failed. So I created a simple static library as follows and built it. ```cpp #pragma once #include namespace static_test { void str_test(LPCSTR

[Issue 20716] Wrong code/ABI for extern(C++) interface method that returns non-POD

2020-08-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20716 Walter Bright changed: What|Removed |Added Keywords||backend CC|

[Issue 20716] Wrong code/ABI for extern(C++) interface method that returns non-POD

2020-03-31 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20716 Илья Ярошенко changed: What|Removed |Added Keywords||C++, wrong-code --- Comment #1 from Илья

[Issue 20716] New: Wrong code/ABI for extern(C++) interface method that returns non-POD

2020-03-31 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20716 Issue ID: 20716 Summary: Wrong code/ABI for extern(C++) interface method that returns non-POD Product: D Version: D2 Hardware: x86_64 OS: Linux

Re: C interface provides a pointer and a length... wrap without copying?

2017-03-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, March 12, 2017 02:47:19 cy via Digitalmars-d-learn wrote: > On Saturday, 11 March 2017 at 23:43:54 UTC, Nicholas Wilson wrote: > > A string *is* a pointer length pair, an immutable(char)[]. > > Yes, but surely there's some silly requirement, like that the > pointer must only ever point

Re: C interface provides a pointer and a length... wrap without copying?

2017-03-11 Thread ketmar via Digitalmars-d-learn
cy wrote: On Saturday, 11 March 2017 at 23:43:54 UTC, Nicholas Wilson wrote: A string *is* a pointer length pair, an immutable(char)[]. Yes, but surely there's some silly requirement, like that the pointer must only ever point to garbage collected memory, or something? why should it? a

Re: C interface provides a pointer and a length... wrap without copying?

2017-03-11 Thread cy via Digitalmars-d-learn
On Saturday, 11 March 2017 at 23:43:54 UTC, Nicholas Wilson wrote: A string *is* a pointer length pair, an immutable(char)[]. Yes, but surely there's some silly requirement, like that the pointer must only ever point to garbage collected memory, or something? ubyte[] arr; // or byte/char

Re: C interface provides a pointer and a length... wrap without copying?

2017-03-11 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 11 March 2017 at 22:39:02 UTC, cy wrote: So a lovely C library does its own opaque allocation, and provides access to the malloc'd memory, and that memory's length. Instead of copying the results into garbage collected memory (which would probably be smart) I was thinking about

Re: C interface provides a pointer and a length... wrap without copying?

2017-03-11 Thread ketmar via Digitalmars-d-learn
cy wrote: So a lovely C library does its own opaque allocation, and provides access to the malloc'd memory, and that memory's length. Instead of copying the results into garbage collected memory (which would probably be smart) I was thinking about creating a structure like: struct

C interface provides a pointer and a length... wrap without copying?

2017-03-11 Thread cy via Digitalmars-d-learn
So a lovely C library does its own opaque allocation, and provides access to the malloc'd memory, and that memory's length. Instead of copying the results into garbage collected memory (which would probably be smart) I was thinking about creating a structure like: struct WrappedString {

Re: Creating array of structs being used in C interface

2016-11-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 27 November 2016 at 23:25:57 UTC, Nicholas Wilson wrote: `_D10neo4jTypes17neo4j_map_entry_t6__initZ`, or Unions are supposed to be default initialised with the first member, a ulong and thus should be zero initialised. Right, but neo4j_map_entry_t is a struct and that's the one it

Re: Creating array of structs being used in C interface

2016-11-27 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 27 November 2016 at 13:54:54 UTC, Adam D. Ruppe wrote: On Sunday, 27 November 2016 at 12:59:32 UTC, Timoses wrote: [...] It is a linker problem because you didn't link to it... D structs have an initializer, even if they are used for interfacing with C. This is a small blob of

Re: Creating array of structs being used in C interface

2016-11-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 27 November 2016 at 15:56:13 UTC, Stefan Koch wrote: Does your answer also explain why it works when I move the mytypes.d into the source/ folder? dub will link it in when it is in the source folder. exactly.

Re: Creating array of structs being used in C interface

2016-11-27 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 27 November 2016 at 15:23:33 UTC, Timoses wrote: On Sunday, 27 November 2016 at 14:27:54 UTC, Adam D. Ruppe wrote: That's because int is zero initialized by default and thus doesn't need anything more than a call to zero memory function, and double isn't (it is NaN), so it gets an

Re: Creating array of structs being used in C interface

2016-11-27 Thread Timoses via Digitalmars-d-learn
On Sunday, 27 November 2016 at 14:27:54 UTC, Adam D. Ruppe wrote: That's because int is zero initialized by default and thus doesn't need anything more than a call to zero memory function, and double isn't (it is NaN), so it gets an initializer data blob. If you make it = 0 it might work, but

Re: Creating array of structs being used in C interface

2016-11-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 27 November 2016 at 14:12:31 UTC, Timoses wrote: If I change the union's variable type to "int" (or any other) it compiles just fine. So the problem seems to be the "double" value. That's because int is zero initialized by default and thus doesn't need anything more than a call to

Re: Creating array of structs being used in C interface

2016-11-27 Thread Timoses via Digitalmars-d-learn
On Sunday, 27 November 2016 at 13:22:36 UTC, Nicholas Wilson wrote: The missing symbol is the struct initialiser for neo4j_map_entry_t. Not sure why is not being generated (it should), possibly because of the union. That seems like a bug please report it. http://issues.dlang.org/ Thanks

Re: Creating array of structs being used in C interface

2016-11-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 27 November 2016 at 12:59:32 UTC, Timoses wrote: Why is it a linker problem? I'm not linking to the c interface but merely using D structs... It is a linker problem because you didn't link to it... D structs have an initializer, even if they are used for interfacing with C

Re: Creating array of structs being used in C interface

2016-11-27 Thread Nicholas Wilson via Digitalmars-d-learn
neo4jTypes17neo4j_map_entry_t6__initZ", referenced from: _D6myprogram6myprogram5test2MFZv in myprogram.o ld: symbol(s) not found for architecture x86_64 ______ Why is it a linker problem? I'm not linking to the c interface but merely using D structs... The missing symbol is the struct i

Creating array of structs being used in C interface

2016-11-27 Thread Timoses via Digitalmars-d-learn
m6myprogram5test2MFZv in myprogram.o ld: symbol(s) not found for architecture x86_64 ______ Why is it a linker problem? I'm not linking to the c interface but merely using D structs...

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

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

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.

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

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

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

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(_ID, cast(IUnknown)null, CLSCTX_INPROC_SERVER, _ID, cast(void**)); How are you casting your "ptr" variable

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(_ID, cast(IUnknown)null, CLSCTX_INPROC_SERVER, _ID, cast(void**)); See the example above. IUnknown ptr = null; auto res = CoCreateInstance(, null,

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(_ID, cast(IUnknown)null, CLSCTX_INPROC_SERVER, _ID, cast(void**)); How are you casting your "ptr" variable (which BTW should be just void* or usually IUnknown) to your

Re: C++ interface vs D and com

2016-07-13 Thread Adam Sansier via Digitalmars-d-learn
gular interface in that there is no object.Interface entry in vtbl[0]; the entries vtbl[0..$] are all the virtual function pointers, in the order that they were declared. This matches the COM object layout used by Windows. A C++ interface differs from a regular interface in that it matches the l

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

Re: C++ interface vs D and com

2016-07-13 Thread Adam Sansier via Digitalmars-d-learn
tbl[0]; the entries vtbl[0..$] are all the virtual function pointers, in the order that they were declared. This matches the COM object layout used by Windows. A C++ interface differs from a regular interface in that it matches the layout of a C++ class using single inheritance on the target ma

Re: C++ interface vs D and com

2016-07-12 Thread Mike Parker via Digitalmars-d-learn
order that they were declared. This matches the COM object layout used by Windows. A C++ interface differs from a regular interface in that it matches the layout of a C++ class using single inheritance on the target machine. " You don't need extern(C++) for COM interfaces. There are several

Re: C++ interface vs D and com

2016-07-12 Thread Adam Sansier via Digitalmars-d-learn
tbl[0]; the entries vtbl[0..$] are all the virtual function pointers, in the order that they were declared. This matches the COM object layout used by Windows. A C++ interface differs from a regular interface in that it matches the layout of a C++ class using single inheritance on the target machine. "

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

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**) *y = malloc(iInterface.sizeof); x.__vptr = cast(immutable(void*)*)(*ptr);

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

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

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

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

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

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

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.

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

C++ interface vs D and com

2016-07-12 Thread Adam Sansier via Digitalmars-d-learn
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(C++) so it's a C++ style interface. The first field of a

[Issue 13867] Overriding a method from an extern(C++) interface requires extern(C++) on the method definition

2016-05-06 Thread via Digitalmars-d-bugs
an extern(C++) interface https://github.com/dlang/dmd/commit/b862dab3ba938f4302192947de241b2ac024f95e Merge pull request #5732 from lionello/fix13867 fix Issue 13867 - Improve error message when overriding an extern(C++) interface --

[Issue 13867] Overriding a method from an extern(C++) interface requires extern(C++) on the method definition

2016-05-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13867 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 13867] Overriding a method from an extern(C++) interface requires extern(C++) on the method definition

2016-05-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13867 Lionello Lunesu changed: What|Removed |Added Keywords||pull

[Issue 15647] Casting from one C++ interface in a hierarchy to another is a noop

2016-02-06 Thread via Digitalmars-d-bugs
from one C++ interface in a hierarchy to another is a noop https://github.com/D-Programming-Language/dmd/commit/3a1a7e2196497d2dbd233a4bb4c2b2c7a7d3ebb2 Merge pull request #5402 from WalterBright/fix15647 fix Issue 15647 - Casting from one C++ interface in a hierarchy to an… --

[Issue 15647] Casting from one C++ interface in a hierarchy to another is a noop

2016-02-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15647 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 15647] Casting from one C++ interface in a hierarchy to another is a noop

2016-02-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15647 Walter Bright changed: What|Removed |Added Keywords||C++ --

[Issue 15647] New: Casting from one C++ interface in a hierarchy to another is a noop

2016-02-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15647 Issue ID: 15647 Summary: Casting from one C++ interface in a hierarchy to another is a noop Product: D Version: D2 Hardware: All OS: All Status: NEW

Re: DMD 2.68's promised C++ interface

2015-07-21 Thread Suliman via Digitalmars-d
On Monday, 20 July 2015 at 16:06:43 UTC, Shriramana Sharma wrote: Just now saw Walter's tentative roadmap going forward to 2.69 etc... I don't see anything mentioned about the promised C++ interface. Was I mistaken in thinking that it is part of 2.68? Please can anyone in the know have mercy

Re: DMD 2.68's promised C++ interface

2015-07-20 Thread Jacob Carlborg via Digitalmars-d
On 2015-07-20 18:06, Shriramana Sharma via Digitalmars-d wrote: Just now saw Walter's tentative roadmap going forward to 2.69 etc... I don't see anything mentioned about the promised C++ interface. Was I mistaken in thinking that it is part of 2.68? Please can anyone in the know have mercy

DMD 2.68's promised C++ interface

2015-07-20 Thread Shriramana Sharma via Digitalmars-d
Just now saw Walter's tentative roadmap going forward to 2.69 etc... I don't see anything mentioned about the promised C++ interface. Was I mistaken in thinking that it is part of 2.68? Please can anyone in the know have mercy on us lesser souls and update http://dlang.org/cpp_interface.html

Re: DMD 2.68's promised C++ interface

2015-07-20 Thread Guillaume Chatelet via Digitalmars-d
On Monday, 20 July 2015 at 16:06:43 UTC, Shriramana Sharma wrote: Just now saw Walter's tentative roadmap going forward to 2.69 etc... I don't see anything mentioned about the promised C++ interface. Was I mistaken in thinking that it is part of 2.68? Please can anyone in the know have mercy

Re: DMD 2.68's promised C++ interface

2015-07-20 Thread Elie Morisse via Digitalmars-d
On Monday, 20 July 2015 at 16:06:43 UTC, Shriramana Sharma wrote: I really really want to interface to Qt 5 and am groping in the dark here as to what to do with c'tors, inheritance, c c... Maybe not the original meaning of the promise but:

Re: DMD 2.68's promised C++ interface

2015-07-20 Thread jmh530 via Digitalmars-d
On Monday, 20 July 2015 at 23:27:22 UTC, Elie Morisse wrote: Despite the lack of update it has kept progressing and I'm within an inch or two of breaking the silence and making a new announcement. It's pretty close to usability with C++ libraries of any complexity. Cool.

[Issue 1688] extern (C++) interface and vtbl

2015-06-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1688 Andrei Alexandrescu and...@erdani.com changed: What|Removed |Added Version|unspecified |D2 --

Re: C++ interface problem

2015-04-30 Thread Benjamin Thaut via Digitalmars-d-learn
On Wednesday, 29 April 2015 at 19:04:11 UTC, extrawurst wrote: On Wednesday, 29 April 2015 at 13:55:46 UTC, Benjamin Thaut wrote: On Monday, 27 April 2015 at 21:19:02 UTC, extrawurst wrote: here is the shortened version of the returned class CSteamID:

Re: C++ interface problem

2015-04-30 Thread extrawurst via Digitalmars-d-learn
On Thursday, 30 April 2015 at 08:18:16 UTC, Benjamin Thaut wrote: On Wednesday, 29 April 2015 at 19:04:11 UTC, extrawurst wrote: On Wednesday, 29 April 2015 at 13:55:46 UTC, Benjamin Thaut wrote: On Monday, 27 April 2015 at 21:19:02 UTC, extrawurst wrote: here is the shortened version of the

Re: C++ interface problem

2015-04-29 Thread extrawurst via Digitalmars-d-learn
On Wednesday, 29 April 2015 at 13:55:46 UTC, Benjamin Thaut wrote: On Monday, 27 April 2015 at 21:19:02 UTC, extrawurst wrote: here is the shortened version of the returned class CSteamID: https://gist.github.com/Extrawurst/936f56ceaa87cf287257 this is the shortened interface (no destructors

Re: C++ interface problem

2015-04-29 Thread Benjamin Thaut via Digitalmars-d-learn
On Monday, 27 April 2015 at 21:19:02 UTC, extrawurst wrote: here is the shortened version of the returned class CSteamID: https://gist.github.com/Extrawurst/936f56ceaa87cf287257 this is the shortened interface (no destructors in the rest of the code either):

[Issue 13867] Overriding a method from an extern(C++) interface requires extern(C++) on the method definition

2015-04-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13867 nick nicolas.jincher...@gmail.com changed: What|Removed |Added Severity|enhancement |normal --

Re: C++ interface problem

2015-04-27 Thread extrawurst via Digitalmars-d-learn
(); extern(C++) interface I { void foo(); S bar(); } ``` now the question is why does it crash to access bar() in both cases? (using alias aswell as the struct) The C++ class S is a POD class (it contains only 64bits of data and is compiled byte aligned) The call to bar() from D just crashes

Re: C++ interface problem

2015-04-27 Thread extrawurst via Digitalmars-d-learn
; unsigned intm_EAccountType : 4; EUniversem_EUniverse : 8; } m_comp; uint64 m_unAll64Bits; } m_steamid; } ``` Where is the fuction declaratiosn for bar? If bar is not virtual you can not use a extern(C++) Interface. If bar is non-virtual you

Re: C++ interface problem

2015-04-27 Thread Laeeth Isharc via Digitalmars-d-learn
On Sunday, 26 April 2015 at 15:49:46 UTC, extrawurst wrote: I hope someone can tell me where my bug is. I am linking to a dynamic library with C++ interfaces: ``` //alias S = ulong; struct S { ulong data; } extern(C) I getI(); extern(C++) interface I { void foo(); S bar(); } ``` now

Re: C++ interface problem

2015-04-27 Thread Benjamin Thaut via Digitalmars-d-learn
m_EUniverse : 8; } m_comp; uint64 m_unAll64Bits; } m_steamid; } ``` Where is the fuction declaratiosn for bar? If bar is not virtual you can not use a extern(C++) Interface. If bar is non-virtual you have to use a extern(C++) class.

Re: C++ interface problem

2015-04-27 Thread Benjamin Thaut via Digitalmars-d-learn
On Monday, 27 April 2015 at 11:00:23 UTC, extrawurst wrote: Thought about that too and tried uint aswell. does not work either.. Please post the c++ declarations as well. Which c++ compiler do you use for win32? (dmc or msvc) Kind Regards Benjamin

Re: C++ interface problem

2015-04-27 Thread extrawurst via Digitalmars-d-learn
On Monday, 27 April 2015 at 12:56:57 UTC, Benjamin Thaut wrote: On Monday, 27 April 2015 at 11:00:23 UTC, extrawurst wrote: Thought about that too and tried uint aswell. does not work either.. Please post the c++ declarations as well. Which c++ compiler do you use for win32? (dmc or msvc)

Re: C++ interface problem

2015-04-27 Thread extrawurst via Digitalmars-d-learn
m_EAccountType : 4; EUniverse m_EUniverse : 8; } m_comp; uint64 m_unAll64Bits; } m_steamid; } ``` Where is the fuction declaratiosn for bar? If bar is not virtual you can not use a extern(C++) Interface. If bar

Re: C++ interface problem

2015-04-27 Thread Benjamin Thaut via Digitalmars-d-learn
; EUniversem_EUniverse : 8; } m_comp; uint64 m_unAll64Bits; } m_steamid; } ``` Where is the fuction declaratiosn for bar? If bar is not virtual you can not use a extern(C++) Interface. If bar is non-virtual you have to use a extern(C++) class. of course it is all

[Issue 13867] Overriding a method from an extern(C++) interface requires extern(C++) on the method definition

2015-04-26 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13867 --- Comment #1 from nick nicolas.jincher...@gmail.com --- +1 for allowing extern(C++) interface members to be implemented without specifying the linkage. In fact, I believe it is a bug for this not to be the case. Consider this example: interface

C++ interface problem

2015-04-26 Thread extrawurst via Digitalmars-d-learn
I hope someone can tell me where my bug is. I am linking to a dynamic library with C++ interfaces: ``` //alias S = ulong; struct S { ulong data; } extern(C) I getI(); extern(C++) interface I { void foo(); S bar(); } ``` now the question is why does it crash to access bar() in both

[Issue 13867] Overriding a method from an extern(C++) interface requires extern(C++) on the method definition

2015-04-26 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13867 nick nicolas.jincher...@gmail.com changed: What|Removed |Added CC|

Re: how to pass a ubyte[] to c interface?

2015-03-13 Thread Rikki Cattermole via Digitalmars-d-learn
On 13/03/2015 7:47 p.m., zhmt wrote: On Friday, 13 March 2015 at 06:39:31 UTC, Rikki Cattermole wrote: On 13/03/2015 7:35 p.m., zhmt wrote: ubyte[] arr ; I pass the arr.ptr to c program, it fails silently. Is there any way to cast a ubyte[] to a clang pointer? Theoretically this should

Re: how to pass a ubyte[] to c interface?

2015-03-13 Thread zhmt via Digitalmars-d-learn
On Friday, 13 March 2015 at 06:39:31 UTC, Rikki Cattermole wrote: On 13/03/2015 7:35 p.m., zhmt wrote: ubyte[] arr ; I pass the arr.ptr to c program, it fails silently. Is there any way to cast a ubyte[] to a clang pointer? Theoretically this should work. D: void func(ubyte[] value) {

how to pass a ubyte[] to c interface?

2015-03-13 Thread zhmt via Digitalmars-d-learn
ubyte[] arr ; I pass the arr.ptr to c program, it fails silently. Is there any way to cast a ubyte[] to a clang pointer?

  1   2   >