Re: Build AA from two simple array

2019-03-23 Thread Alex via Digitalmars-d-learn
On Saturday, 23 March 2019 at 09:25:52 UTC, Andrey wrote: Hello, I have got 2 simple arrays with the same length: int[] values = [1, 2, 3, 4, 5]; char[] keys = ['a', 'b', 'c', 'd', 'e']; auto result = buildAA(keys, values); // [a: 1, b: 2, c: 3, d: 4, e: 5] I want to build AA "result" using

Build AA from two simple array

2019-03-23 Thread Andrey via Digitalmars-d-learn
Hello, I have got 2 simple arrays with the same length: int[] values = [1, 2, 3, 4, 5]; char[] keys = ['a', 'b', 'c', 'd', 'e']; auto result = buildAA(keys, values); // [a: 1, b: 2, c: 3, d: 4, e: 5] I want to build AA "result" using "values" and "keys". How to do it?

Re: Calling D library from other languages on linux using foreign threads

2019-03-23 Thread Andre Pany via Digitalmars-d-learn
On Friday, 22 March 2019 at 19:34:14 UTC, tchaloupka wrote: I've searched a lot at it should be working at least on linux, but apparently is not or I'm doing something totally wrong.. [...] I just noticed another issue which might be related but I doubt.

Re: Another Tuesday (Friday?), Another GtkDcoding Blog Post

2019-03-23 Thread number via Digitalmars-d-learn
On Friday, 22 March 2019 at 23:34:08 UTC, Ron Tarrant wrote: It's fixed now. The first one :), now there's still the other one "Here’s a second code file for you."

Re: Shared library loading and static constructor

2019-03-23 Thread Andre Pany via Digitalmars-d-learn
On Friday, 22 March 2019 at 17:52:34 UTC, Sobaya wrote: On Friday, 22 March 2019 at 11:00:32 UTC, Andre Pany wrote: On Friday, 22 March 2019 at 10:51:58 UTC, Sobaya wrote: [...] As far as I know different to windows, linus will not search current working directory for a.so. if this is the

Re: Calling D library from other languages on linux using foreign threads

2019-03-23 Thread tchaloupka via Digitalmars-d-learn
On Saturday, 23 March 2019 at 09:47:55 UTC, Andre Pany wrote: On Friday, 22 March 2019 at 19:34:14 UTC, tchaloupka wrote: Just to make sure, could you test it with dmd 2.78? Actually when I remove the explicit GC call within unregistered thread (which is fixed in

Re: Matching an array-type of a C++ function signature in D, without using a D-array-type, because the compiler crashes otherwise

2019-03-23 Thread kinke via Digitalmars-d-learn
On Saturday, 23 March 2019 at 11:35:45 UTC, Simon wrote: Is there any way to end up with the correct mangled function signature, using only pointer types? The problem is that the C++ compiler uses head-const for the array param (`float * const`), which cannot be represented in D. What you

Re: Calling D library from other languages on linux using foreign threads

2019-03-23 Thread Ali Çehreli via Digitalmars-d-learn
On 03/22/2019 12:34 PM, tchaloupka wrote: > I've searched a lot at it should be working at least on linux, but > apparently is not or I'm doing something totally wrong.. > > Our use case is to call shared D library from C# (.Net Core) and from > different threads. We needed to do the same from

Re: Matching an array-type of a C++ function signature in D, without using a D-array-type, because the compiler crashes otherwise

2019-03-23 Thread Simon via Digitalmars-d-learn
On Saturday, 23 March 2019 at 13:04:10 UTC, kinke wrote: On Saturday, 23 March 2019 at 11:35:45 UTC, Simon wrote: Is there any way to end up with the correct mangled function signature, using only pointer types? The problem is that the C++ compiler uses head-const for the array param (`float

Matching an array-type of a C++ function signature in D, without using a D-array-type, because the compiler crashes otherwise

2019-03-23 Thread Simon via Digitalmars-d-learn
Hi, I experienced some trouble with DMD today, while trying to declare an external C++ function in D, that gets linked from a C++ compiled object file. The C++ function that I want to link against is declared as follows: bool ColorEdit4(const char* label, float col[4], int flags = 0);

Re: Calling D library from other languages on linux using foreign threads

2019-03-23 Thread tchaloupka via Digitalmars-d-learn
On Saturday, 23 March 2019 at 15:28:34 UTC, Ali Çehreli wrote: On 03/22/2019 12:34 PM, tchaloupka wrote: > I've searched a lot at it should be working at least on linux, but > apparently is not or I'm doing something totally wrong.. > > Our use case is to call shared D library from C# (.Net

Re: Shared library loading and static constructor

2019-03-23 Thread tchaloupka via Digitalmars-d-learn
On Saturday, 23 March 2019 at 15:58:07 UTC, Sobaya wrote: What I am saying is that it can not be read when a code importing (a.d) a code including the static constructor (b.d) is compiled into shared library. Hi. I've tried to add your case to the repository and at it seems to be working

Re: Shared library loading and static constructor

2019-03-23 Thread Sobaya via Digitalmars-d-learn
On Saturday, 23 March 2019 at 16:56:28 UTC, tchaloupka wrote: On Saturday, 23 March 2019 at 15:58:07 UTC, Sobaya wrote: What I am saying is that it can not be read when a code importing (a.d) a code including the static constructor (b.d) is compiled into shared library. Hi. I've tried to

Re: Shared library loading and static constructor

2019-03-23 Thread Sobaya via Digitalmars-d-learn
On Saturday, 23 March 2019 at 09:37:16 UTC, Andre Pany wrote: On Friday, 22 March 2019 at 17:52:34 UTC, Sobaya wrote: On Friday, 22 March 2019 at 11:00:32 UTC, Andre Pany wrote: On Friday, 22 March 2019 at 10:51:58 UTC, Sobaya wrote: [...] As far as I know different to windows, linus will