why adding extern(C) cause a runtime error?

2015-07-10 Thread mzfhhhh via Digitalmars-d-learn
win7 x86 dmd2.067.1 ok ubuntu x64 dmd2.067.1 error - import std.stdio; import std.socket; extern(C) void recv() { writeln("recv..."); } extern(C) void send() { writeln("send..."); } int main(string[] argv) { //copy from std.socket unittest

Re: std.concurrency: The fate of unmatched messages

2015-07-10 Thread ketmar via Digitalmars-d-learn
On Fri, 10 Jul 2015 19:39:24 +, E.S. Quinn wrote: > the documentation i can find for std.concurrency mentions what happens > when one receive() call gets a message it doesn't understand. that `receive()` will not get such a message. `receive()` scans the whole mailbox to find the message it

Re: std.concurrency: The fate of unmatched messages

2015-07-10 Thread ketmar via Digitalmars-d-learn
On Sat, 11 Jul 2015 01:52:23 +, E.S. Quinn wrote: > On Friday, 10 July 2015 at 23:39:30 UTC, ketmar wrote: >> this way your `receive` will get all messages. simply do nothing in >> `Variant` handler to drop messages you don't want to process. >> >> >> [1] http://dlang.org/phobos/std_concurrenc

Re: std.concurrency: The fate of unmatched messages

2015-07-10 Thread E.S. Quinn via Digitalmars-d-learn
On Friday, 10 July 2015 at 23:39:30 UTC, ketmar wrote: this way your `receive` will get all messages. simply do nothing in `Variant` handler to drop messages you don't want to process. [1] http://dlang.org/phobos/std_concurrency.html#.receive The thing is, I want to do receive() in two sepa

Re: incorrect data when returning static array in place of dynamic

2015-07-10 Thread sigod via Digitalmars-d-learn
On Monday, 6 July 2015 at 14:56:38 UTC, Marc Schütz wrote: On Monday, 6 July 2015 at 10:20:28 UTC, anonymous wrote: dmd 2.068.0 catches this. You can get the beta here: http://downloads.dlang.org/pre-releases/2.x/2.068.0/ ... and it already contains a std.digest.hmac module :-) Yes, thanks.

Re: incorrect data when returning static array in place of dynamic

2015-07-10 Thread sigod via Digitalmars-d-learn
On Monday, 6 July 2015 at 10:20:28 UTC, anonymous wrote: On Monday, 6 July 2015 at 07:48:17 UTC, sigod wrote: Aren't compiler smart enough to prevent it? ``` ubyte[] test1() { auto b = sha1Of(""); return b; // Error: escaping reference to local b } ubyte[] test2() { re

Re: bigint compile time errors

2015-07-10 Thread Kai Nacke via Digitalmars-d-learn
On Tuesday, 7 July 2015 at 22:19:22 UTC, Paul D Anderson wrote: On Sunday, 5 July 2015 at 20:35:03 UTC, Kai Nacke wrote: On Friday, 3 July 2015 at 04:08:32 UTC, Paul D Anderson wrote: On Friday, 3 July 2015 at 03:57:57 UTC, Anon wrote: On Friday, 3 July 2015 at 02:37:00 UTC, Paul D Anderson wr

std.concurrency: The fate of unmatched messages

2015-07-10 Thread E.S. Quinn via Digitalmars-d-learn
I'm putting together a program that uses std.concurrency to handle two child threads from the main thread; The kicker here is that both the children do very different things. And I would like to handle receive() calls for them in separate locations. But from what I can tell, each thread has o

Re: goroutines vs vibe.d tasks

2015-07-10 Thread Sönke Ludwig via Digitalmars-d-learn
Am 01.07.2015 um 09:55 schrieb Daniel Kozák: On Wed, 01 Jul 2015 03:28:01 + "rsw0x" wrote: how do they compare if you replace the sleep with yield? > Same problem still extreamly slow Hm, this is strange. I'll have to find some time to profile this. More or less all that yield() does

Re: goroutines vs vibe.d tasks

2015-07-10 Thread Sönke Ludwig via Digitalmars-d-learn
Am 01.07.2015 um 20:09 schrieb Mathias Lang: On Tuesday, 30 June 2015 at 15:18:36 UTC, Jack Applegame wrote: Just creating a bunch (10k) of sleeping (for 100 msecs) goroutines/tasks. Compilers go: go version go1.4.2 linux/amd64 vibe.d: DMD64 D Compiler v2.067.1 linux/amd64, vibe.d 0.7.23 C

Re: Is it legal to have a function taking two aliased slices?

2015-07-10 Thread ponce via Digitalmars-d-learn
On Friday, 10 July 2015 at 13:54:47 UTC, Steven Schveighoffer wrote: On 7/10/15 9:20 AM, ponce wrote: Example: void process(float[] input, float[] output) { // do stuff } I'd like to sometimes have overlapping slices, and don't want the compiler to assume they do not o

Re: Is it legal to have a function taking two aliased slices?

2015-07-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/10/15 9:20 AM, ponce wrote: Example: void process(float[] input, float[] output) { // do stuff } I'd like to sometimes have overlapping slices, and don't want the compiler to assume they do not overlap. Yes, it's legal, and the compiler doesn't assume anything ab

Is it legal to have a function taking two aliased slices?

2015-07-10 Thread ponce via Digitalmars-d-learn
Example: void process(float[] input, float[] output) { // do stuff } I'd like to sometimes have overlapping slices, and don't want the compiler to assume they do not overlap.

Re: DUB Build Linker Library Search Path

2015-07-10 Thread via Digitalmars-d-learn
On Friday, 10 July 2015 at 12:04:53 UTC, Nordlöw wrote: Should be LFLAGS="-L/usr/lib/llvm-3.6/lib" dub build --compiler=/usr/bin/dmd but still fails I can't find any place in the DUB sources that reads `LFLAGS` from the environment. Only one place when `DFLAGS` is read. A regression?

Re: DUB Build Linker Library Search Path

2015-07-10 Thread Nordlöw
On Friday, 10 July 2015 at 11:56:23 UTC, Nordlöw wrote: fails aswell: Should be LFLAGS="-L/usr/lib/llvm-3.6/lib" dub build --compiler=/usr/bin/dmd but still fails

Re: DUB Build Linker Library Search Path

2015-07-10 Thread Nordlöw
On Friday, 10 July 2015 at 11:21:34 UTC, Rikki Cattermole wrote: No no, LFLAGS not LDFLAGS. It's basically lflags from dub file but in environment args. No, doesn't work: LFLAGS="-L-L/usr/lib/llvm-3.6/lib" dub build --compiler=/usr/bin/dmd fails aswell: Target tango 1.0.1+2.067 is up t

Re: Import module

2015-07-10 Thread codenstuff via Digitalmars-d-learn
On Friday, 10 July 2015 at 10:22:39 UTC, anonymous wrote: On Friday, 10 July 2015 at 00:53:38 UTC, codenstuff wrote: On Friday, 10 July 2015 at 00:24:44 UTC, anonymous wrote: [...] [...] The path is ${HOME}/d_apps/steering/steering/game_object.d Compile command is dmd map/map.d main_visual

Re: DUB Build Linker Library Search Path

2015-07-10 Thread Nordlöw
On Friday, 10 July 2015 at 11:02:16 UTC, Nordlöw wrote: What's wrong with my call to DUB? I'm sitting on DUB git master. Found DFLAGS="-L-L/usr/lib/llvm-3.6/lib" dub build --compiler=/usr/bin/dmd to work but that's a bit ugly.

Re: DUB Build Linker Library Search Path

2015-07-10 Thread Rikki Cattermole via Digitalmars-d-learn
On 10/07/2015 11:02 p.m., "Nordlöw" wrote: On Friday, 10 July 2015 at 09:37:42 UTC, Rikki Cattermole wrote: On 10/07/2015 9:34 p.m., "Nordlöw" wrote: On Friday, 10 July 2015 at 09:29:49 UTC, Martin Nowak wrote: On Friday, 10 July 2015 at 09:27:19 UTC, Nordlöw wrote: How do I tell `dub build`

Re: DUB Build Linker Library Search Path

2015-07-10 Thread Nordlöw
On Friday, 10 July 2015 at 09:37:42 UTC, Rikki Cattermole wrote: On 10/07/2015 9:34 p.m., "Nordlöw" wrote: On Friday, 10 July 2015 at 09:29:49 UTC, Martin Nowak wrote: On Friday, 10 July 2015 at 09:27:19 UTC, Nordlöw wrote: How do I tell `dub build` where to find libraries in non-standard dir

Re: Import module

2015-07-10 Thread anonymous via Digitalmars-d-learn
On Friday, 10 July 2015 at 00:53:38 UTC, codenstuff wrote: On Friday, 10 July 2015 at 00:24:44 UTC, anonymous wrote: On Thursday, 9 July 2015 at 22:05:23 UTC, codenstuff wrote: I am trying to import module and compile. The compiler produces message map/map.d(9): Error: module game_object is i

Re: Import module

2015-07-10 Thread anonymous via Digitalmars-d-learn
On Friday, 10 July 2015 at 03:11:25 UTC, Mike Parker wrote: On Friday, 10 July 2015 at 00:53:38 UTC, codenstuff wrote: The path is ${HOME}/d_apps/steering/steering/game_object.d [...] First, because you are importing sterring.game_object, then you can't pass -I/home/real/d_apps/steering to

Re: DUB Build Linker Library Search Path

2015-07-10 Thread Rikki Cattermole via Digitalmars-d-learn
On 10/07/2015 9:34 p.m., "Nordlöw" wrote: On Friday, 10 July 2015 at 09:29:49 UTC, Martin Nowak wrote: On Friday, 10 July 2015 at 09:27:19 UTC, Nordlöw wrote: How do I tell `dub build` where to find libraries in non-standard directories? You're missing the development package libclang-dev, wh

Re: DUB Build Linker Library Search Path

2015-07-10 Thread Nordlöw
On Friday, 10 July 2015 at 09:29:49 UTC, Martin Nowak wrote: On Friday, 10 July 2015 at 09:27:19 UTC, Nordlöw wrote: How do I tell `dub build` where to find libraries in non-standard directories? You're missing the development package libclang-dev, which should come with a pkg-config. I've

DUB Build Linker Library Search Path

2015-07-10 Thread Nordlöw
My DUB building of dstep on Ubuntu 15.04 fails because it can't find the libclang which is placed in /usr/lib/llvm3-6/lib/libclang.so.1 How do I tell `dub build` where to find libraries in non-standard directories?

Re: DUB Build Linker Library Search Path

2015-07-10 Thread Martin Nowak via Digitalmars-d-learn
On Friday, 10 July 2015 at 09:27:19 UTC, Nordlöw wrote: How do I tell `dub build` where to find libraries in non-standard directories? You're missing the development package libclang-dev, which should come with a pkg-config.

Re: DUB Build Linker Library Search Path

2015-07-10 Thread Nordlöw
On Friday, 10 July 2015 at 09:27:19 UTC, Nordlöw wrote: How do I tell `dub build` where to find libraries in non-standard directories? From the command line that is...

Re: Fixed Length Array Syntax in extern(C) Function Signatures

2015-07-10 Thread via Digitalmars-d-learn
On Friday, 10 July 2015 at 08:54:57 UTC, Andrea Fontana wrote: Is there any tool out there that automatically creates D wrappers from C headers`? https://github.com/jacob-carlborg/dstep ? Great! I'll try that!

Re: Fixed Length Array Syntax in extern(C) Function Signatures

2015-07-10 Thread Andrea Fontana via Digitalmars-d-learn
On Friday, 10 July 2015 at 08:42:06 UTC, Per Nordlöw wrote: On Friday, 10 July 2015 at 03:18:23 UTC, Mike Parker wrote: [1]http://dlang.org/interfaceToC.html Is there any tool out there that automatically creates D wrappers from C headers`? https://github.com/jacob-carlborg/dstep ?

Re: Fixed Length Array Syntax in extern(C) Function Signatures

2015-07-10 Thread via Digitalmars-d-learn
On Friday, 10 July 2015 at 03:18:23 UTC, Mike Parker wrote: [1]http://dlang.org/interfaceToC.html Is there any tool out there that automatically creates D wrappers from C headers`?

Re: Fixed Length Array Syntax in extern(C) Function Signatures

2015-07-10 Thread Nordlöw
On Friday, 10 July 2015 at 03:18:23 UTC, Mike Parker wrote: You should just be able to replace `[4]` with `*` in the arguments. [1]http://dlang.org/interfaceToC.html Great! One more thing: How shall my call to `avg_image_copy()` (from D) look then? Is the slicing syntax `[0 .. 4]` I use abo

Re: Binding Nested C Structs

2015-07-10 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-07-10 05:38, Craig Dillabaugh wrote: I am trying to bind to a C union with a number of nested structs declared as follows: typedef union { int Integer; struct { int nCount; int *paList; } IntegerList; struct { int nCoun