Re: Why was new(size_t s) { } deprecated in favor of an external allocator?

2020-10-15 Thread Daniel Kozak via Digitalmars-d-learn
On Wed, Oct 14, 2020 at 10:30 PM Jack via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > What was the reasoning behind this decision? > https://dlang.org/deprecate.html#Class allocators and deallocators

Re: Why was new(size_t s) { } deprecated in favor of an external allocator?

2020-10-15 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 15 October 2020 at 06:39:00 UTC, Patrick Schluter wrote: On Wednesday, 14 October 2020 at 20:32:51 UTC, Max Haughton wrote: On Wednesday, 14 October 2020 at 20:27:10 UTC, Jack wrote: What was the reasoning behind this decision? Andrei's std::allocator talk from a few years ago

Re: Why was new(size_t s) { } deprecated in favor of an external allocator?

2020-10-15 Thread Patrick Schluter via Digitalmars-d-learn
On Wednesday, 14 October 2020 at 20:32:51 UTC, Max Haughton wrote: On Wednesday, 14 October 2020 at 20:27:10 UTC, Jack wrote: What was the reasoning behind this decision? Andrei's std::allocator talk from a few years ago at cppcon covers this (amongst other things) Yes, and what did he

winapi, dll

2020-10-15 Thread Atmosfear via Digitalmars-d-learn
I didn't find how to call the queryperformancecounter function. I tried this. Returns errors, doesn't know what BOOL and LARGE_INTEGER are. import core.sys.windows.windows; import core.sys.windows.w32api; import core.sys.windows.winbase; pragma(lib, "kernel32"); extern (Windows) { BOOL

Re: Error on dub build - Trying Vibe-d for the first time

2020-10-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/14/20 2:25 PM, Andre Pany wrote: On Wednesday, 14 October 2020 at 18:08:40 UTC, H. S. Teoh wrote: On Wed, Oct 14, 2020 at 05:30:37PM +, Andre Pany via Digitalmars-d-learn wrote: On Wednesday, 14 October 2020 at 16:39:39 UTC, Imperatorn wrote: > On Wednesday, 14 October 2020 at

Re: Error on dub build - Trying Vibe-d for the first time

2020-10-15 Thread Andre Pany via Digitalmars-d-learn
On Thursday, 15 October 2020 at 13:17:57 UTC, Steven Schveighoffer wrote: On 10/14/20 2:25 PM, Andre Pany wrote: On Wednesday, 14 October 2020 at 18:08:40 UTC, H. S. Teoh wrote: On Wed, Oct 14, 2020 at 05:30:37PM +, Andre Pany via Digitalmars-d-learn wrote: > > [...] [...] > > [...]

Re: winapi, dll

2020-10-15 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 15 October 2020 at 12:45:42 UTC, Atmosfear wrote: I didn't find how to call the queryperformancecounter function. I tried this. Returns errors, doesn't know what BOOL and LARGE_INTEGER are. import core.sys.windows.windows; import core.sys.windows.w32api; import

Re: Error on dub build - Trying Vibe-d for the first time

2020-10-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/15/20 10:22 AM, Steven Schveighoffer wrote: On 10/15/20 9:55 AM, Andre Pany wrote: I meant this one: https://github.com/vibe-d/eventcore/pull/154 I testing it at the moment, while there still "leaking" warnings, the ports are released after terminating the application with Ctrl+c. So

Re: malloc(s)[0..s] vs cast(T)malloc(s)

2020-10-15 Thread Jack via Digitalmars-d-learn
On Thursday, 15 October 2020 at 01:22:54 UTC, Ali Çehreli wrote: On 10/14/20 1:15 PM, Jack wrote: >> auto x = malloc(s)[0..s]; > https://wiki.dlang.org/Memory_Management#Explicit_Class_Instance_Allocation Note that 'x' is passed to emplace() at that link and emplace() requires a slice.

Re: malloc(s)[0..s] vs cast(T)malloc(s)

2020-10-15 Thread Jack via Digitalmars-d-learn
On Wednesday, 14 October 2020 at 21:12:13 UTC, Paul Backus wrote: On Wednesday, 14 October 2020 at 20:15:39 UTC, Jack wrote: [...] The difference is that the first version gives you a `void[]`, and the second version gives you a `T`. Neither version does any bounds checking. Generally,

Re: Error on dub build - Trying Vibe-d for the first time

2020-10-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/15/20 9:55 AM, Andre Pany wrote: I meant this one: https://github.com/vibe-d/eventcore/pull/154 I testing it at the moment, while there still "leaking" warnings, the ports are released after terminating the application with Ctrl+c. So far I was not able to reproduce the issue with

Re: Error on dub build - Trying Vibe-d for the first time

2020-10-15 Thread Andre Pany via Digitalmars-d-learn
On Thursday, 15 October 2020 at 14:26:37 UTC, Steven Schveighoffer wrote: On 10/15/20 10:22 AM, Steven Schveighoffer wrote: On 10/15/20 9:55 AM, Andre Pany wrote: I meant this one: https://github.com/vibe-d/eventcore/pull/154 I testing it at the moment, while there still "leaking"

Re: Why was new(size_t s) { } deprecated in favor of an external allocator?

2020-10-15 Thread Max Haughton via Digitalmars-d-learn
On Thursday, 15 October 2020 at 06:39:00 UTC, Patrick Schluter wrote: On Wednesday, 14 October 2020 at 20:32:51 UTC, Max Haughton wrote: On Wednesday, 14 October 2020 at 20:27:10 UTC, Jack wrote: What was the reasoning behind this decision? Andrei's std::allocator talk from a few years ago

Re: winapi, dll

2020-10-15 Thread Atmosfear via Digitalmars-d-learn
On Thursday, 15 October 2020 at 16:32:06 UTC, Imperatorn wrote: On Thursday, 15 October 2020 at 12:45:42 UTC, Atmosfear wrote: I didn't find how to call the queryperformancecounter function. I tried this. Returns errors, doesn't know what BOOL and LARGE_INTEGER are. import

Re: winapi, dll

2020-10-15 Thread rikki cattermole via Digitalmars-d-learn
On 16/10/2020 9:13 AM, Atmosfear wrote: I'm a newby. Can you show me an example? In which module is it? You can search for it on Github and it'll show up. https://github.com/dlang/druntime/search?q=QueryPerformanceCounter

Re: winapi, dll

2020-10-15 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 15 October 2020 at 20:13:37 UTC, Atmosfear wrote: On Thursday, 15 October 2020 at 16:32:06 UTC, Imperatorn wrote: On Thursday, 15 October 2020 at 12:45:42 UTC, Atmosfear wrote: I didn't find how to call the queryperformancecounter function. I tried this. Returns errors, doesn't

Re: why do i need an extern(C): here?

2020-10-15 Thread Ali Çehreli via Digitalmars-d-learn
On 10/15/20 2:29 PM, WhatMeWorry wrote: > name wrangling? Name mangling. :) I don't know the answer but I can hijack your thread. > import core.runtime; > auto mydll = Runtime.loadLibrary("mydll.dll"); Interesting. I've recently done the same by calling dlopen() and dlsym()

Re: winapi, dll

2020-10-15 Thread Atmosfear via Digitalmars-d-learn
On Thursday, 15 October 2020 at 20:47:43 UTC, Imperatorn wrote: On Thursday, 15 October 2020 at 20:13:37 UTC, Atmosfear wrote: On Thursday, 15 October 2020 at 16:32:06 UTC, Imperatorn wrote: [...] I'm a newby. Can you show me an example? In which module is it? I see. What Editor/IDE are

Re: winapi, dll

2020-10-15 Thread John Chapman via Digitalmars-d-learn
On Thursday, 15 October 2020 at 20:13:37 UTC, Atmosfear wrote: On Thursday, 15 October 2020 at 16:32:06 UTC, Imperatorn wrote: On Thursday, 15 October 2020 at 12:45:42 UTC, Atmosfear wrote: I didn't find how to call the queryperformancecounter function. I tried this. Returns errors, doesn't

Re: why do i need an extern(C): here?

2020-10-15 Thread IGotD- via Digitalmars-d-learn
On Thursday, 15 October 2020 at 21:29:59 UTC, WhatMeWorry wrote: I've go a small DLL and a test module both written in D. Why do I need to use the extern(C)? Shouldn't both sides be using D name wrangling? You have answered your own question. If you're not using extern(C), D just like

why do i need an extern(C): here?

2020-10-15 Thread WhatMeWorry via Digitalmars-d-learn
I've go a small DLL and a test module both written in D. Why do I need to use the extern(C)? Shouldn't both sides be using D name wrangling? mydll.d module mydll; extern(C): // removing or changing to (D): results in error export {

Re: why do i need an extern(C): here?

2020-10-15 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Oct 15, 2020 at 09:47:16PM +, IGotD- via Digitalmars-d-learn wrote: > On Thursday, 15 October 2020 at 21:29:59 UTC, WhatMeWorry wrote: > > > > I've go a small DLL and a test module both written in D. Why do I > > need to use the extern(C)? Shouldn't both sides be using D name > >

How can I use class and wasm?

2020-10-15 Thread Jack via Digitalmars-d-learn
can I make it work? the code (see below) result in link error: lld: error: wasm.o: undefined symbol: _D4wasm1C7__ClassZ lld: error: wasm.o: undefined symbol: _d_allocclass Error: linking with LLD failed command line: ldc2 --d-debug -mtriple=wasm32-unknown-unknown-wasm -betterC wasm.d ldc

Re: How can I use class and wasm?

2020-10-15 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 16 October 2020 at 03:04:25 UTC, Jack wrote: How can I allocate memory for this class? It is possible but not easy without druntime. If you are using -betterC, you can use extern(C++) classes with extern(D) members. The compiler will let you declare that. But then you need to

Re: winapi, dll

2020-10-15 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 15 October 2020 at 20:59:10 UTC, Atmosfear wrote: I use online DMD. I'll try VS 2019 with the VisualD. That's the issue, then. The online versions of DMD run on Linux. You don't need VisualD for this. Just plain old dmd in a text editor will do.

Re: winapi, dll

2020-10-15 Thread Jack via Digitalmars-d-learn
On Thursday, 15 October 2020 at 20:13:37 UTC, Atmosfear wrote: On Thursday, 15 October 2020 at 16:32:06 UTC, Imperatorn wrote: On Thursday, 15 October 2020 at 12:45:42 UTC, Atmosfear wrote: I didn't find how to call the queryperformancecounter function. I tried this. Returns errors, doesn't

Re: How can I use class and wasm?

2020-10-15 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 15 October 2020 at 22:02:11 UTC, Jack wrote: can I make it work? the code (see below) result in link error: lld: error: wasm.o: undefined symbol: _D4wasm1C7__ClassZ lld: error: wasm.o: undefined symbol: _d_allocclass Error: linking with LLD failed command line: ldc2 --d-debug

Re: How can I use class and wasm?

2020-10-15 Thread Jack via Digitalmars-d-learn
On Friday, 16 October 2020 at 02:43:19 UTC, Paul Backus wrote: On Thursday, 15 October 2020 at 22:02:11 UTC, Jack wrote: can I make it work? the code (see below) result in link error: lld: error: wasm.o: undefined symbol: _D4wasm1C7__ClassZ lld: error: wasm.o: undefined symbol: _d_allocclass