Re: Statically compiled binary with C interop crashes.

2024-04-18 Thread Steven Schveighoffer via Digitalmars-d-learn
On Thursday, 18 April 2024 at 11:05:07 UTC, yabobay wrote: On Wednesday, 17 April 2024 at 15:24:07 UTC, Ferhat Kurtulmuş wrote: On Wednesday, 17 April 2024 at 11:03:22 UTC, yabobay wrote: I'm using [dray](https://code.dlang.org/packages/dray) in my project with dub, here's the relevant parts

Re: Statically compiled binary with C interop crashes.

2024-04-18 Thread yabobay via Digitalmars-d-learn
On Wednesday, 17 April 2024 at 15:24:07 UTC, Ferhat Kurtulmuş wrote: On Wednesday, 17 April 2024 at 11:03:22 UTC, yabobay wrote: I'm using [dray](https://code.dlang.org/packages/dray) in my project with dub, here's the relevant parts of the dub.json: [...] İt seems your issue is related to

Re: Statically compiled binary with C interop crashes.

2024-04-17 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Wednesday, 17 April 2024 at 11:03:22 UTC, yabobay wrote: I'm using [dray](https://code.dlang.org/packages/dray) in my project with dub, here's the relevant parts of the dub.json: [...] İt seems your issue is related to the raylib itself, neither the binding you use nor the d programming

Statically compiled binary with C interop crashes.

2024-04-17 Thread yabobay via Digitalmars-d-learn
I'm using [dray](https://code.dlang.org/packages/dray) in my project with dub, here's the relevant parts of the dub.json: ```json "dependencies" : {"dray": "~>4.2.0-r3"}, "dflags-ldc": ["--static"], "lflags": ["-static"] ``` In my regular setup with Debian, i can compile and run my

[Issue 23885] [CI] C++ interop tests with g++ fail

2023-05-16 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23885 --- Comment #5 from Dlang Bot --- dlang/dmd pull request #15238 "merge stable" was merged into master: - 30bc65203c12536bceab4a361dae4aa2e81a104f by Dennis: Fix Issue 23885 - Rearranging the commands makes the crypto operations not fail (#15210)

[Issue 23885] [CI] C++ interop tests with g++ fail

2023-05-09 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23885 --- Comment #4 from Dlang Bot --- dlang/dmd pull request #15210 "[Stable] Try to fix g++ failures phrasing command differently" was merged into stable: - 0836e7cd4612b8c99fe30be304e1bfa680ced73e by mhh: Fix Issue 23885 - Rearranging the commands

[Issue 23885] [CI] C++ interop tests with g++ fail

2023-05-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23885 Dlang Bot changed: What|Removed |Added Status|NEW |RESOLVED Resolution|---

[Issue 23885] [CI] C++ interop tests with g++ fail

2023-05-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23885 Dlang Bot changed: What|Removed |Added Keywords||pull --- Comment #2 from Dlang Bot ---

[Issue 23885] [CI] C++ interop tests with g++ fail

2023-05-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23885 --- Comment #1 from Dlang Bot --- @dkorpel created dlang/dmd pull request #15183 "Issue 23885 - [CI] disable failing g++ tests" mentioning this issue: - Issue 23885 - [CI] disable failing g++ tests https://github.com/dlang/dmd/pull/15183 --

[Issue 23885] New: [CI] C++ interop tests with g++ fail

2023-05-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23885 Issue ID: 23885 Summary: [CI] C++ interop tests with g++ fail Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1

[Issue 21903] Class construction for C++ interop with -betterC

2023-04-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21903 RazvanN changed: What|Removed |Added Status|NEW |RESOLVED CC|

[Issue 21307] Testsuite Networking Heisenbug in C++ interop tests / Run (ubuntu-16.04, g++-7)

2022-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21307 Iain Buclaw changed: What|Removed |Added Priority|P1 |P3 --

[Issue 21388] C++ interop tests / Run (macOS-10.15, clang-7.0.0) (pull_request) Failing after 2m — Run (macOS-10.15, clang-7.0.0)

2022-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21388 Iain Buclaw changed: What|Removed |Added Priority|P1 |P3 --

[Issue 18008] Need C/C++ interop tests for empty anonymous structs/unions

2022-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18008 Iain Buclaw changed: What|Removed |Added Priority|P1 |P3 --

[Issue 21090] Test Suite: C++ interop tests heisenbug

2022-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21090 Iain Buclaw changed: What|Removed |Added Priority|P1 |P3 --

[Issue 21903] Class construction for C++ interop with -betterC

2022-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21903 Iain Buclaw changed: What|Removed |Added Priority|P1 |P4 --

[Issue 21903] Class construction for C++ interop with -betterC

2021-11-08 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21903 kinke changed: What|Removed |Added CC||ki...@gmx.net --- Comment #3 from kinke --- This

[Issue 21903] Class construction for C++ interop with -betterC

2021-11-07 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21903 Tomáš Chaloupka changed: What|Removed |Added Keywords||betterC, C++ CC|

[Issue 21903] Class construction for C++ interop with -betterC

2021-05-07 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21903 --- Comment #2 from SHOO --- (In reply to Adam D. Ruppe from comment #1) > Try > > scope B b = new B(); > > it should work. This method is not flexible enough for compound use of custom allocators, templates, and classes without default

[Issue 21903] Class construction for C++ interop with -betterC

2021-05-07 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21903 Adam D. Ruppe changed: What|Removed |Added CC||destructiona...@gmail.com --- Comment #1

[Issue 21903] New: Class construction for C++ interop with -betterC

2021-05-07 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21903 Issue ID: 21903 Summary: Class construction for C++ interop with -betterC Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement

Re: Using the Standard Library with C++ Interop

2021-02-05 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 5 February 2021 at 21:40:29 UTC, wolfiesnotfine wrote: In any case, I'm unsure how I would runtime init from C++. Is there a specific function I should call? https://dlang.org/phobos/core_runtime.html#.rt_init Could this be done at compile time in a consteval or constexpr

Re: Using the Standard Library with C++ Interop

2021-02-05 Thread wolfiesnotfine via Digitalmars-d-learn
On Friday, 5 February 2021 at 21:11:20 UTC, Adam D. Ruppe wrote: tbh I'd say just don't use betterC, you can still runtime init from C++ and be judicious in what features you use to keep it more minimal. Hmm. I'm mostly concerned about issues or slowdowns in mixing the manual memory

Re: Using the Standard Library with C++ Interop

2021-02-05 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 5 February 2021 at 21:04:00 UTC, wolfiesnotfine wrote: however sse() from core.cpuid is incorrectly reporting as false. The function properly returns true if it's not called from C++ but instead a D main function. That makes me think it is a static constructor, and indeed there is

Using the Standard Library with C++ Interop

2021-02-05 Thread wolfiesnotfine via Digitalmars-d-learn
Hello, I'm currently working on a primarily C++ project but I wanted to leverage some of D's language features and library for a few parts. I'm using the betterC subset and here's the code snippet in D: https://run.dlang.io/is/XOXF06 It's quite a simple test, and the code just gets called

Re: C++ interop, abstract struct problem

2020-12-29 Thread RSY via Digitalmars-d-learn
Here is a debugger view of the passed IAllocator& https://i.imgur.com/p04Tj4a.png

Re: C++ interop, abstract struct problem

2020-12-29 Thread RSY via Digitalmars-d-learn
Hmm, something seems to be very wrong, here what i got so far ``` D struct IAllocator { } struct DefaultAllocator { // BASE -- IAllocator base = IAllocator(); alias base this; //

Re: C++ interop, abstract struct problem

2020-12-28 Thread RSY via Digitalmars-d-learn
On Monday, 28 December 2020 at 16:42:19 UTC, Paul Backus wrote: On Monday, 28 December 2020 at 15:42:26 UTC, RSY wrote: ``IAllocator`` is an abstract struct, (a struct with virtual functions) But the problem is D doesn't allow that, so apparently i need to use an abstract class and wrap it

Re: C++ interop, abstract struct problem

2020-12-28 Thread Paul Backus via Digitalmars-d-learn
On Monday, 28 December 2020 at 15:42:26 UTC, RSY wrote: ``IAllocator`` is an abstract struct, (a struct with virtual functions) But the problem is D doesn't allow that, so apparently i need to use an abstract class and wrap it using: ``extern (C++, struct)`` You could try using one of the

Re: C++ interop, abstract struct problem

2020-12-28 Thread RSY via Digitalmars-d-learn
IAllocator struct: https://github.com/nem0/LumixEngine/blob/master/src/engine/allocator.h#L18 function: https://github.com/nem0/LumixEngine/blob/master/src/renderer/gpu/gpu.h#L208

C++ interop, abstract struct problem

2020-12-28 Thread RSY via Digitalmars-d-learn
Hello I try to use a C++ lib So far so good, i managed to use that lib and get started The problem however is this: C++ API: ``` void preinit(IAllocator& allocator, bool load_renderdoc); ``` ``IAllocator`` is an abstract struct, (a struct with virtual functions) But the problem is D

[Issue 21090] Test Suite: C++ interop tests heisenbug

2020-11-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21090 Walter Bright changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|WONTFIX

[Issue 21388] C++ interop tests / Run (macOS-10.15, clang-7.0.0) (pull_request) Failing after 2m — Run (macOS-10.15, clang-7.0.0)

2020-11-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21388 Walter Bright changed: What|Removed |Added Keywords||TestSuite --

[Issue 21388] New: C++ interop tests / Run (macOS-10.15, clang-7.0.0) (pull_request) Failing after 2m — Run (macOS-10.15, clang-7.0.0)

2020-11-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21388 Issue ID: 21388 Summary: C++ interop tests / Run (macOS-10.15, clang-7.0.0) (pull_request) Failing after 2m — Run (macOS-10.15, clang-7.0.0) Product: D Version: D2

[Issue 21307] Testsuite Networking Heisenbug in C++ interop tests / Run (ubuntu-16.04, g++-7)

2020-10-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21307 Walter Bright changed: What|Removed |Added Keywords||TestSuite --

[Issue 21307] New: Testsuite Networking Heisenbug in C++ interop tests / Run (ubuntu-16.04, g++-7)

2020-10-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21307 Issue ID: 21307 Summary: Testsuite Networking Heisenbug in C++ interop tests / Run (ubuntu-16.04, g++-7) Product: D Version: D2 Hardware: All OS: Linux

[Issue 21130] Test Suite: C++ interop tests / Run (macOS-10.15, clang-4.0.0) fails with X Setup job

2020-08-16 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21130 moonlightsenti...@disroot.org changed: What|Removed |Added Status|REOPENED|RESOLVED CC|

[Issue 21130] Test Suite: C++ interop tests / Run (macOS-10.15, clang-4.0.0) fails with X Setup job

2020-08-09 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21130 Walter Bright changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|INVALID

[Issue 21130] Test Suite: C++ interop tests / Run (macOS-10.15, clang-4.0.0) fails with X Setup job

2020-08-09 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21130 Mathias LANG changed: What|Removed |Added Status|NEW |RESOLVED CC|

[Issue 21130] Test Suite: C++ interop tests / Run (macOS-10.15, clang-4.0.0) fails with X Setup job

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

[Issue 21130] New: Test Suite: C++ interop tests / Run (macOS-10.15, clang-4.0.0) fails with X Setup job

2020-08-06 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21130 Issue ID: 21130 Summary: Test Suite: C++ interop tests / Run (macOS-10.15, clang-4.0.0) fails with X Setup job Product: D Version: D2 Hardware: x86_64 OS: Mac OS

[Issue 21090] Test Suite: C++ interop tests heisenbug

2020-07-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21090 Mathias LANG changed: What|Removed |Added Status|NEW |RESOLVED CC|

[Issue 21090] New: Test Suite: C++ interop tests heisenbug

2020-07-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21090 Issue ID: 21090 Summary: Test Suite: C++ interop tests heisenbug Product: D Version: D2 Hardware: All OS: Mac OS X Status: NEW Severity: normal

[Issue 21090] Test Suite: C++ interop tests heisenbug

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

[Issue 21051] Test Suite C++ interop tests / Run (ubuntu-16.04, g++-9) failed with 'Store Artifacts'

2020-07-19 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21051 Mathias LANG changed: What|Removed |Added Status|NEW |RESOLVED CC|

[Issue 21051] Test Suite C++ interop tests / Run (ubuntu-16.04, g++-9) failed with 'Store Artifacts'

2020-07-18 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21051 Walter Bright changed: What|Removed |Added Keywords||TestSuite --

[Issue 21051] New: Test Suite C++ interop tests / Run (ubuntu-16.04, g++-9) failed with 'Store Artifacts'

2020-07-18 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21051 Issue ID: 21051 Summary: Test Suite C++ interop tests / Run (ubuntu-16.04, g++-9) failed with 'Store Artifacts' Product: D Version: D2 Hardware: All OS: Linux

Re: A question about C++ interop

2020-03-29 Thread YD via Digitalmars-d-learn
On Sunday, 29 March 2020 at 17:32:59 UTC, kinke wrote: On Sunday, 29 March 2020 at 15:20:52 UTC, YD wrote: So what do I need to declare in the D file for it to match the library entry? Thanks! This is similar to https://issues.dlang.org/show_bug.cgi?id=19260, and can be worked around the

Re: A question about C++ interop

2020-03-29 Thread kinke via Digitalmars-d-learn
On Sunday, 29 March 2020 at 15:20:52 UTC, YD wrote: So what do I need to declare in the D file for it to match the library entry? Thanks! This is similar to https://issues.dlang.org/show_bug.cgi?id=19260, and can be worked around the same way by messing manually with the mangled name, if

Re: A question about C++ interop

2020-03-29 Thread YD via Digitalmars-d-learn
On Sunday, 29 March 2020 at 15:20:52 UTC, YD wrote: On Sunday, 29 March 2020 at 01:50:24 UTC, evilrat wrote: [...] Thanks, dummy placeholder works. But there is a new problem on Windows, let's say there are two classes in C++: [...] Actually I found that if I create a C wrapper like

Re: A question about C++ interop

2020-03-29 Thread YD via Digitalmars-d-learn
On Sunday, 29 March 2020 at 01:50:24 UTC, evilrat wrote: ... Same here, STL bindings is not yet finished. If you don't need that method specifically, just replace it with a dummy. Or make your own bindings. Thanks, dummy placeholder works. But there is a new problem on Windows, let's say

Re: A question about C++ interop

2020-03-28 Thread evilrat via Digitalmars-d-learn
On Saturday, 28 March 2020 at 19:14:38 UTC, YD wrote: Hi, now I have a further question: when the C++ class A actually has a method that looks like virtual void get_info(std::string ) const = 0; in order to preserve the virtual function table layout (I found that if I omit this

Re: A question about C++ interop

2020-03-28 Thread YD via Digitalmars-d-learn
On Saturday, 28 March 2020 at 07:33:38 UTC, Jacob Carlborg wrote: On 2020-03-27 20:17, YD wrote: Hi, I have a C++ header file which looks like     class A {     public:     static A *create();     virtual int f() const = 0;     }; And there is a C++ library file which provides

Re: A question about C++ interop

2020-03-28 Thread YD via Digitalmars-d-learn
On Saturday, 28 March 2020 at 07:33:38 UTC, Jacob Carlborg wrote: On 2020-03-27 20:17, YD wrote: [...] Classes in D are always passed by reference. Try dropping the pointer in the `create` method: static A create(); Thanks! I got it to work for now.

Re: A question about C++ interop

2020-03-28 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-03-27 20:17, YD wrote: Hi, I have a C++ header file which looks like     class A {     public:     static A *create();     virtual int f() const = 0;     }; And there is a C++ library file which provides the implementation, so that if I write a C++ program and call    

A question about C++ interop

2020-03-27 Thread YD via Digitalmars-d-learn
Hi, I have a C++ header file which looks like class A { public: static A *create(); virtual int f() const = 0; }; And there is a C++ library file which provides the implementation, so that if I write a C++ program and call auto *p = A::create(); std::cout

Re: C++ Interop

2018-01-07 Thread Laeeth Isharc via Digitalmars-d-learn
On Saturday, 6 January 2018 at 11:17:56 UTC, Seb wrote: On Friday, 5 January 2018 at 13:02:12 UTC, qznc wrote: I'm exploring [0] C++ interop after watching Walter's presentation [1]. [...] I know about this: https://github.com/Remedy-Entertainment/binderoo https://github.com/dlang

Re: C++ Interop

2018-01-06 Thread Andres Clari via Digitalmars-d-learn
On Saturday, 6 January 2018 at 13:51:54 UTC, qznc wrote: It would be great to have std::vector and std::string out of the box in D, but putting it into druntime? Druntime is supposed to be shared among all frontends, isn't it? GCC and Clang probably do not have equivalent vector/string classes

Re: C++ Interop

2018-01-06 Thread qznc via Digitalmars-d-learn
On Saturday, 6 January 2018 at 11:20:01 UTC, Seb wrote: On Saturday, 6 January 2018 at 11:17:56 UTC, Seb wrote: On Friday, 5 January 2018 at 13:02:12 UTC, qznc wrote: I'm exploring [0] C++ interop after watching Walter's presentation [1]. [...] I know about this: https://github.com/Remedy

Re: C++ Interop

2018-01-06 Thread Mengu via Digitalmars-d-learn
On Friday, 5 January 2018 at 13:02:12 UTC, qznc wrote: I'm exploring [0] C++ interop after watching Walter's presentation [1]. I hit a block with classes as template parameters. This means vector works, but vector does not. D seems to map vector!Foo to vector<Foo*>. Likewise shar

Re: C++ Interop

2018-01-06 Thread Seb via Digitalmars-d-learn
On Saturday, 6 January 2018 at 11:17:56 UTC, Seb wrote: On Friday, 5 January 2018 at 13:02:12 UTC, qznc wrote: I'm exploring [0] C++ interop after watching Walter's presentation [1]. [...] I know about this: https://github.com/Remedy-Entertainment/binderoo https://github.com/dlang

Re: C++ Interop

2018-01-06 Thread Seb via Digitalmars-d-learn
On Friday, 5 January 2018 at 13:02:12 UTC, qznc wrote: I'm exploring [0] C++ interop after watching Walter's presentation [1]. [...] I know about this: https://github.com/Remedy-Entertainment/binderoo https://github.com/dlang/druntime/pull/1802

Re: C++ Interop

2018-01-05 Thread Timothee Cour via Digitalmars-d-learn
see also https://github.com/Syniurge/Calypso/ although I'm having lots of issues using it on OSX On Fri, Jan 5, 2018 at 9:02 AM, qznc via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote: > I'm exploring [0] C++ interop after watching Walter's presentation [1]. > >

C++ Interop

2018-01-05 Thread qznc via Digitalmars-d-learn
I'm exploring [0] C++ interop after watching Walter's presentation [1]. I hit a block with classes as template parameters. This means vector works, but vector does not. D seems to map vector!Foo to vector<Foo*>. Likewise shared_ptr is a problem. Any way to fix that on the D side? Th

[Issue 18008] Need C/C++ interop tests for empty anonymous structs/unions

2017-11-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18008 Mike changed: What|Removed |Added See Also||https://issues.dlang.org/sh

[Issue 18008] New: Need C/C++ interop tests for empty anonymous structs/unions

2017-11-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18008 Issue ID: 18008 Summary: Need C/C++ interop tests for empty anonymous structs/unions Product: D Version: D2 Hardware: All OS: All Status: NEW

Re: C++ interop; object destruction

2017-06-22 Thread Manu via Digitalmars-d
On 23 June 2017 at 13:45, Danni Coy via Digitalmars-d < digitalmars-d@puremagic.com> wrote: > > > On Fri, Jun 23, 2017 at 10:52 AM, Nicholas Wilson via Digitalmars-d < > digitalmars-d@puremagic.com> wrote: > >> >>> >> I'm pretty sure he manually constructs the vtbl and inserts the virtual >>

Re: C++ interop; object destruction

2017-06-22 Thread Manu via Digitalmars-d
On 23 June 2017 at 10:52, Nicholas Wilson via Digitalmars-d < digitalmars-d@puremagic.com> wrote: > On Friday, 23 June 2017 at 00:33:55 UTC, Manu wrote: > >> On 23 June 2017 at 09:32, Nicholas Wilson via Digitalmars-d < >> digitalmars-d@puremagic.com> wrote: >> >> On Thursday, 22 June 2017 at

Re: C++ interop; object destruction

2017-06-22 Thread Danni Coy via Digitalmars-d
On Fri, Jun 23, 2017 at 10:52 AM, Nicholas Wilson via Digitalmars-d < digitalmars-d@puremagic.com> wrote: > >> > I'm pretty sure he manually constructs the vtbl and inserts the virtual > function into it, so it should just be a case of calling the virtual > destructor. > > Have a look at this

Re: C++ interop; object destruction

2017-06-22 Thread Nicholas Wilson via Digitalmars-d
On Friday, 23 June 2017 at 00:33:55 UTC, Manu wrote: On 23 June 2017 at 09:32, Nicholas Wilson via Digitalmars-d < digitalmars-d@puremagic.com> wrote: On Thursday, 22 June 2017 at 12:52:26 UTC, Manu wrote: How do I properly implement object destruction of extern(C++) classes (with virtual

Re: C++ interop; object destruction

2017-06-22 Thread Manu via Digitalmars-d
On 23 June 2017 at 09:32, Nicholas Wilson via Digitalmars-d < digitalmars-d@puremagic.com> wrote: > On Thursday, 22 June 2017 at 12:52:26 UTC, Manu wrote: > >> How do I properly implement object destruction of extern(C++) classes >> (with >> virtual destructors)? >> >> [...] >> > > Also didn't

Re: C++ interop; object destruction

2017-06-22 Thread Nicholas Wilson via Digitalmars-d
On Thursday, 22 June 2017 at 12:52:26 UTC, Manu wrote: How do I properly implement object destruction of extern(C++) classes (with virtual destructors)? [...] Also didn't Ethan come up with a solution for this for Binderoo?

Re: C++ interop; object destruction

2017-06-22 Thread ketmar via Digitalmars-d
Nicholas Wilson wrote: On Thursday, 22 June 2017 at 12:52:26 UTC, Manu wrote: How do I properly implement object destruction of extern(C++) classes (with virtual destructors)? I'm not going to embarrass myself by pasting some of my attempts to achieve this goal to date. I take it you

Re: C++ interop; object destruction

2017-06-22 Thread Nicholas Wilson via Digitalmars-d
On Thursday, 22 June 2017 at 12:52:26 UTC, Manu wrote: How do I properly implement object destruction of extern(C++) classes (with virtual destructors)? I'm not going to embarrass myself by pasting some of my attempts to achieve this goal to date. I take it you tried calling super.~this()

C++ interop; object destruction

2017-06-22 Thread Manu via Digitalmars-d
How do I properly implement object destruction of extern(C++) classes (with virtual destructors)? I'm not going to embarrass myself by pasting some of my attempts to achieve this goal to date. I've asked before, but I've never yet seen a sufficiently solution to this problem. Situation: I have

Re: C++ interop

2017-01-30 Thread Timothee Cour via Digitalmars-d
also: catch D exceptions from C++ vs catching C++ exceptions from D; IIRC only one direction is supported On Mon, Jan 30, 2017 at 11:42 AM, kinke via Digitalmars-d < digitalmars-d@puremagic.com> wrote: > I was wondering whether C++ interop is already considered sufficiently > wo

C++ interop

2017-01-30 Thread kinke via Digitalmars-d
I was wondering whether C++ interop is already considered sufficiently working enough, as I don't see any plans for improving it in the H1 2017 vision, except for the `C++ stdlib interface` bullet point. IMO, the main obstacles for mixed D/C++ RAII-style code are: 1) Constructors don't work

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-11 Thread deadalnix via Digitalmars-d
On Sunday, 11 September 2016 at 12:11:43 UTC, David Nadlinger wrote: On Sunday, 11 September 2016 at 11:33:14 UTC, Dicebot wrote: On Sunday, 11 September 2016 at 08:37:56 UTC, deadalnix wrote: On Sunday, 11 September 2016 at 06:09:01 UTC, Dicebot wrote: Presence of compile-time valid T.init

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-11 Thread David Nadlinger via Digitalmars-d
On Sunday, 11 September 2016 at 11:33:14 UTC, Dicebot wrote: On Sunday, 11 September 2016 at 08:37:56 UTC, deadalnix wrote: On Sunday, 11 September 2016 at 06:09:01 UTC, Dicebot wrote: Presence of compile-time valid T.init for any type T is absolutely critical for generic programming and must

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-11 Thread Dicebot via Digitalmars-d
On Sunday, 11 September 2016 at 08:37:56 UTC, deadalnix wrote: On Sunday, 11 September 2016 at 06:09:01 UTC, Dicebot wrote: Presence of compile-time valid T.init for any type T is absolutely critical for generic programming and must not be compromised. WAT ? Vast amount of traits operate

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-11 Thread deadalnix via Digitalmars-d
On Sunday, 11 September 2016 at 06:09:01 UTC, Dicebot wrote: Presence of compile-time valid T.init for any type T is absolutely critical for generic programming and must not be compromised. WAT ?

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-11 Thread Dicebot via Digitalmars-d
Presence of compile-time valid T.init for any type T is absolutely critical for generic programming and must not be compromised.

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-10 Thread Nick Treleaven via Digitalmars-d
On Wednesday, 7 September 2016 at 11:20:18 UTC, Lodovico Giaretta wrote: I guess the only thing you can ask and obtain here (I mean, with a bug report) is that @disable this() should be allowed to coexist with static opCall(). That would prevent your users from instantiating structs the wrong

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-10 Thread Ethan Watson via Digitalmars-d
On Saturday, 10 September 2016 at 08:26:44 UTC, rikki cattermole wrote: Is there a good example library for this that does not involve a full blown (game)framework? Not that I'm aware of.

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-10 Thread rikki cattermole via Digitalmars-d
On 10/09/2016 8:22 PM, Ethan Watson wrote: On Saturday, 10 September 2016 at 05:56:55 UTC, Marco Leise wrote: But what about the parts of the code that handle the game initialization before streaming starts? Is there no config = new GameConfig("settings.ini"); or db = new

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-10 Thread Ethan Watson via Digitalmars-d
On Saturday, 10 September 2016 at 08:22:59 UTC, Ethan Watson wrote: And if you exploit that correctly, this is one of those things that can increase boot times, actually. *decrease boot times. Take that, edit button.

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-10 Thread Ethan Watson via Digitalmars-d
On Saturday, 10 September 2016 at 05:56:55 UTC, Marco Leise wrote: But what about the parts of the code that handle the game initialization before streaming starts? Is there no config = new GameConfig("settings.ini"); or db = new AssetDatabase("menu.pkg"); that perform I/O during

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-10 Thread Marco Leise via Digitalmars-d
Am Fri, 09 Sep 2016 14:46:31 + schrieb Ethan Watson : > […] > > First and foremost, resources are processed offline to match the > ideal binary format for the target platform. The industry has > been using DXT textures for over a decade now, and they've been >

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-09 Thread Ethan Watson via Digitalmars-d
On Friday, 9 September 2016 at 12:16:00 UTC, Marco Leise wrote: So when you have an object that reads state from a file, you first construct it and then call a member function "loadFromFile()" that may throw? For argument's sake let's take a *.bmp class. That one would not have a constructor

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-09 Thread Marco Leise via Digitalmars-d
Am Thu, 08 Sep 2016 07:52:58 + schrieb Ethan Watson : > On Wednesday, 7 September 2016 at 21:05:32 UTC, Walter Bright > wrote: > > 5. In my not-so-humble opinion, construction should never fail > > and all constructors should be nothrow, but I understand that > > is a

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-08 Thread Walter Bright via Digitalmars-d
On 9/8/2016 4:26 AM, Ethan Watson wrote: On Thursday, 8 September 2016 at 11:18:12 UTC, Walter Bright wrote: The thing is, the 'destroy()' function is going to swamp any extra clock cycle, as will a virtual lookup and dereference. Assume destroy() is a more trivial function then. The point is

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-08 Thread Yuxuan Shui via Digitalmars-d
On Thursday, 8 September 2016 at 11:18:12 UTC, Walter Bright wrote: http://www.agner.org/optimize/microarchitecture.pdf section 3.13 has a bit more info on the branch predictor. Desktop Intel CPUs tend to hide performance problems like this thanks to their far-higher-quality branch

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-08 Thread deadalnix via Digitalmars-d
On Thursday, 8 September 2016 at 10:06:16 UTC, John Colvin wrote: I think it's too late for this stuff now for D anyway. There are workarounds that make life acceptable without default constructors, I can't see how we could add them without getting into a real mess. The kind of flow analysis

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-08 Thread John Colvin via Digitalmars-d
On Tuesday, 6 September 2016 at 13:44:37 UTC, Ethan Watson wrote: So now I'm in a bind. This is one struct I need to construct uniquely every time. And I also need to keep the usability up to not require calling some other function since this is matching a C++ class's functionality, including

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-08 Thread Ethan Watson via Digitalmars-d
On Thursday, 8 September 2016 at 12:32:44 UTC, Andrei Alexandrescu wrote: One thing we could look at is allow only CTFEable default constructors. Wouldn't work in my case where I need to call a dynamically imported extern( C++ ) function to correctly construct an object.

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-08 Thread Andrei Alexandrescu via Digitalmars-d
On 9/8/16 12:06 PM, John Colvin wrote: I think it's too late for this stuff now for D anyway. There are workarounds that make life acceptable without default constructors, I can't see how we could add them without getting into a real mess. A good point. I should mention, however, that the lack

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-08 Thread Andrei Alexandrescu via Digitalmars-d
On 9/8/16 1:37 AM, Walter Bright wrote: On 9/7/2016 4:05 PM, deadalnix wrote: Consider reference counting for instance. Andrei's scheme for RC doesn't have that issue. Default constructors would help RC design. Raising the roof. -- Andrei

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-08 Thread Ethan Watson via Digitalmars-d
On Thursday, 8 September 2016 at 11:26:22 UTC, Ethan Watson wrote: Being D though. Destructors can be contracted, yeah? Tested. Confirmed.

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-08 Thread Ethan Watson via Digitalmars-d
On Thursday, 8 September 2016 at 11:18:12 UTC, Walter Bright wrote: The thing is, the 'destroy()' function is going to swamp any extra clock cycle, as will a virtual lookup and dereference. Assume destroy() is a more trivial function then. The point is that if you put more than two branches

Re: Struct default constructor - need some kind of solution for C++ interop

2016-09-08 Thread Walter Bright via Digitalmars-d
On 9/8/2016 1:10 AM, Ethan Watson wrote: On Wednesday, 7 September 2016 at 22:52:04 UTC, Walter Bright wrote: Is: if (resource != null) resource.destroy(); v.s.: resource.destroy(); so onerous? It's one TST/JNE pair for a value loaded into a register anyway. This one has

  1   2   3   >