Re: alias and extern(C) for callbacks

2013-08-22 Thread Jacob Carlborg
On 2013-08-23 02:00, Andrej Mitrovic wrote: static assert(functionLinkage!test2 != "C"); // D calling convention Or Windows, Pascal or C++. -- /Jacob Carlborg

Re: alias and extern(C) for callbacks

2013-08-22 Thread Carl Sturtivant
On Friday, 23 August 2013 at 00:00:13 UTC, Andrej Mitrovic wrote: On Thursday, 22 August 2013 at 23:55:44 UTC, Carl Sturtivant wrote: Is Callback here a name for the same type as if it was defined by the following? alias extern(C) int function(int, int) Callback; Yes. If you want to make su

Re: alias and extern(C) for callbacks

2013-08-22 Thread Andrej Mitrovic
On Thursday, 22 August 2013 at 23:55:44 UTC, Carl Sturtivant wrote: Is Callback here a name for the same type as if it was defined by the following? alias extern(C) int function(int, int) Callback; Yes. If you want to make sure, you can use a trait: import std.traits; extern(C) { void tes

alias and extern(C) for callbacks

2013-08-22 Thread Carl Sturtivant
The D language page on interfacing to C http://dlang.org/interfaceToC.html says under 'Callbacks' that e.g. alias extern(C) int function(int, int) Callback; // D code is OK, so I am wondering if I can factor out the extern(C) from aliases as follows extern(C) { alias int function(in

Re: How do i depend on struct composition

2013-08-22 Thread JS
On Thursday, 22 August 2013 at 23:10:40 UTC, anonymous wrote: On Thursday, 22 August 2013 at 22:32:53 UTC, JS wrote: On Thursday, 22 August 2013 at 21:07:27 UTC, Mariusz `shd` Gliwiński wrote: [...] struct InnerC { void operate() { auto ptr = this-(void*).sizeof; /* do something with point

Re: How do i depend on struct composition

2013-08-22 Thread anonymous
On Thursday, 22 August 2013 at 22:32:53 UTC, JS wrote: On Thursday, 22 August 2013 at 21:07:27 UTC, Mariusz `shd` Gliwiński wrote: [...] struct InnerC { void operate() { auto ptr = this-(void*).sizeof; /* do something with pointer */ } } struct Compound(Inner) { Inner a_or_b; Inner

Re: How do i depend on struct composition

2013-08-22 Thread JS
On Thursday, 22 August 2013 at 21:07:27 UTC, Mariusz `shd` Gliwiński wrote: Let me try to illustrate my question by following pseudo-code: struct InnerA { /* .. */ void* ptr; } struct InnerB { /* .. */ void* ptr; } struct InnerC { void operate() { auto ptr = this-(void*).sizeof;

How do i depend on struct composition

2013-08-22 Thread Mariusz `shd` Gliwiński
Let me try to illustrate my question by following pseudo-code: struct InnerA { /* .. */ void* ptr; } struct InnerB { /* .. */ void* ptr; } struct InnerC { void operate() { auto ptr = this-(void*).sizeof; /* do something with pointer */ } } struct Compound(Inner) { Inner

Re: How compile program with curl support?

2013-08-22 Thread Jordi Sayol
On 22/08/13 15:20, evilrat wrote: > On Thursday, 22 August 2013 at 13:15:39 UTC, ilya-stromberg wrote: >> On Thursday, 22 August 2013 at 10:24:49 UTC, David wrote: What should I do to get curl support? OS is Linux Ubuntu 12.10. >>> >>> Install libcurl-dev >>> http://packages.ubuntu.com/de

Re: How compile program with curl support?

2013-08-22 Thread Gary Willoughby
On Thursday, 22 August 2013 at 13:20:44 UTC, evilrat wrote: why do u link phobos when compiler do this for you? For some reason the order of linked libs matters especially with curl.

Re: How compile program with curl support?

2013-08-22 Thread David
Am 22.08.2013 15:27, schrieb ilya-stromberg: > On Thursday, 22 August 2013 at 13:20:44 UTC, evilrat wrote: >> why do u link phobos when compiler do this for you? > > Because without it doesn't work: > > $ dmd -L-lcurl main.d > /usr/lib/x86_64-linux-gnu/libphobos2.a(curl.o): In function > `_D3std3

Re: Order matters on inheritance

2013-08-22 Thread JS
On Thursday, 22 August 2013 at 08:45:36 UTC, Regan Heath wrote: On Thu, 22 Aug 2013 02:43:42 +0100, JS wrote: I don't know what the expected behavior is but it seems odd/wrong: http://dpaste.dzfl.pl/a390f1f4 Note that there are two issues here(almost the same). First is that A.foo isn't c

Re: How compile program with curl support?

2013-08-22 Thread evilrat
On Thursday, 22 August 2013 at 13:27:32 UTC, ilya-stromberg wrote: On Thursday, 22 August 2013 at 13:20:44 UTC, evilrat wrote: why do u link phobos when compiler do this for you? Because without it doesn't work: $ dmd -L-lcurl main.d /usr/lib/x86_64-linux-gnu/libphobos2.a(curl.o): In function

Re: How compile program with curl support?

2013-08-22 Thread ilya-stromberg
On Thursday, 22 August 2013 at 13:20:44 UTC, evilrat wrote: why do u link phobos when compiler do this for you? Because without it doesn't work: $ dmd -L-lcurl main.d /usr/lib/x86_64-linux-gnu/libphobos2.a(curl.o): In function `_D3std3net4curl4Curl19_sharedStaticCtor34FZv': std/net/curl.d:(.t

Re: How compile program with curl support?

2013-08-22 Thread evilrat
On Thursday, 22 August 2013 at 13:15:39 UTC, ilya-stromberg wrote: On Thursday, 22 August 2013 at 10:24:49 UTC, David wrote: What should I do to get curl support? OS is Linux Ubuntu 12.10. Install libcurl-dev http://packages.ubuntu.com/de/lucid/libcurl-dev Add "-L-lcurl" to your commandline

Re: How compile program with curl support?

2013-08-22 Thread ilya-stromberg
On Thursday, 22 August 2013 at 10:24:49 UTC, David wrote: What should I do to get curl support? OS is Linux Ubuntu 12.10. Install libcurl-dev http://packages.ubuntu.com/de/lucid/libcurl-dev Add "-L-lcurl" to your commandline Thanks for help. Correct answer was here: http://forum.dlang.org/po

Re: Resizing child windows using phobos

2013-08-22 Thread evilrat
On Thursday, 22 August 2013 at 11:34:40 UTC, Alex wrote: So i have been trying to send WM_SIZE messages to my child windows in my application window proc. I am sending theese messages when the application window is resized. But it will not work. They keep the same child window size as they have

Resizing child windows using phobos

2013-08-22 Thread Alex
So i have been trying to send WM_SIZE messages to my child windows in my application window proc. I am sending theese messages when the application window is resized. But it will not work. They keep the same child window size as they have from when they were initialized. Is there any other me

Re: How compile program with curl support?

2013-08-22 Thread evilrat
On Thursday, 22 August 2013 at 10:00:20 UTC, Ivan Kazmenko wrote: On Thursday, 22 August 2013 at 07:28:52 UTC, ilya-stromberg wrote: undefined reference to `curl_global_init' undefined reference to `curl_global_cleanup' What should I do to get curl support? OS is Linux Ubuntu 12.10. I recentl

Re: How compile program with curl support?

2013-08-22 Thread David
> What should I do to get curl support? > OS is Linux Ubuntu 12.10. Install libcurl-dev http://packages.ubuntu.com/de/lucid/libcurl-dev Add "-L-lcurl" to your commandline

Re: How compile program with curl support?

2013-08-22 Thread Ivan Kazmenko
On Thursday, 22 August 2013 at 10:00:20 UTC, Ivan Kazmenko wrote: and then I link Sorry, that should have been: and then I link just like dmd myprog.d having both curl.lib (D bindings to C++ binary, built locally) and libcurl.dll (downloaded C++ libcurl binary) findable by the linker (in the s

Re: How compile program with curl support?

2013-08-22 Thread Ivan Kazmenko
On Thursday, 22 August 2013 at 07:28:52 UTC, ilya-stromberg wrote: undefined reference to `curl_global_init' undefined reference to `curl_global_cleanup' What should I do to get curl support? OS is Linux Ubuntu 12.10. I recently had the same problem on Windows (thread: http://forum.dlang.org/

Re: Associative array key order

2013-08-22 Thread Daniel Kozak
On Thursday, 22 August 2013 at 08:41:13 UTC, monarch_dodra wrote: On Thursday, 22 August 2013 at 07:59:05 UTC, Daniel Kozak wrote: On Wednesday, 31 July 2013 at 14:55:55 UTC, Dicebot wrote: On Wednesday, 31 July 2013 at 14:43:21 UTC, Daniel Kozak wrote: is there a way for AA to behave same as

Re: How compile program with curl support?

2013-08-22 Thread evilrat
On Thursday, 22 August 2013 at 07:28:52 UTC, ilya-stromberg wrote: I try to compile program with curl support, but I have error: ... i rarely use rdmd, so i can only advice to try using dmd directly with following flags and see if it works, and if works its a rdmd flags problem in your case:

Re: Order matters on inheritance

2013-08-22 Thread Regan Heath
On Thu, 22 Aug 2013 02:43:42 +0100, JS wrote: I don't know what the expected behavior is but it seems odd/wrong: http://dpaste.dzfl.pl/a390f1f4 Note that there are two issues here(almost the same). First is that A.foo isn't called and second is that the order of inheritance on A matters(:

Re: Associative array key order

2013-08-22 Thread monarch_dodra
On Thursday, 22 August 2013 at 07:59:05 UTC, Daniel Kozak wrote: On Wednesday, 31 July 2013 at 14:55:55 UTC, Dicebot wrote: On Wednesday, 31 July 2013 at 14:43:21 UTC, Daniel Kozak wrote: is there a way for AA to behave same as PHP? I doubt it. This snippet suggests that AA's in PHP are not

Re: Typeof woes

2013-08-22 Thread Artur Skawina
On 08/21/13 02:43, H. S. Teoh wrote: > On Wed, Aug 21, 2013 at 02:24:18AM +0200, Andrej Mitrovic wrote: >> On 8/21/13, H. S. Teoh wrote: >>> and typeof(this.Smth) is invalid because this.Smth is already a >>> type, so you can't apply typeof to it. >> >> I am beginning to wonder if typeof(typeof(ex

Re: Typeof woes

2013-08-22 Thread Artur Skawina
On 08/21/13 02:15, Dicebot wrote: > typeof only accepts expressions, not types. > > Workaround: > > template myTypeOf(T...) >if (T.length == 1) > { > static if (is(T)) > alias myTypeOf = T; > else > alias myTypeOf = typeof(T); > } Keep in mind that 'typeof' is special

Re: Associative array key order

2013-08-22 Thread Daniel Kozak
On Wednesday, 31 July 2013 at 14:55:55 UTC, Dicebot wrote: On Wednesday, 31 July 2013 at 14:43:21 UTC, Daniel Kozak wrote: is there a way for AA to behave same as PHP? I doubt it. This snippet suggests that AA's in PHP are not simply AA's and do additionally track insertion order (or use som

How compile program with curl support?

2013-08-22 Thread ilya-stromberg
I try to compile program with curl support, but I have error: import std.net.curl; void main() { } rdmd main.d /usr/lib/x86_64-linux-gnu/libphobos2.a(curl.o): In function `_D3std3net4curl4Curl19_sharedStaticCtor34FZv': std/net/curl.d:(.text._D3std3net4curl4Curl19_sharedStaticCtor34FZv+0xf): u