std.net.curl not working in 2.058 for Windows

2012-02-24 Thread Brad Anderson
There is no documentation (both on dlang.org and in the local documentation) so I'm not sure if it's supposed to be working yet. I get linker errors when I try to use it: $ dmd netcurl.d OPTLINK (R) for Win32 Release 8.00.12 Copyright (C) Digital Mars 1989-2010 All rights

Re: GDC: how to link with alternate version of Phobos?

2012-02-24 Thread Johannes Pfau
Am Thu, 23 Feb 2012 20:21:57 -0800 schrieb H. S. Teoh hst...@quickfur.ath.cx: I'm trying to test if a bug has been fixed in the latest Phobos git repository, but I'm having trouble convincing gdc to *not* use the default installation of Phobos. What option do I need on the commandline to tell

Re: std.net.curl not working in 2.058 for Windows

2012-02-24 Thread Brad Anderson
On Friday, 24 February 2012 at 07:59:50 UTC, Brad Anderson wrote: There is no documentation (both on dlang.org and in the local documentation) so I'm not sure if it's supposed to be working yet. I get linker errors when I try to use it: $ dmd netcurl.d OPTLINK (R) for Win32 Release

Compiling with -unittest on a c wrapper

2012-02-24 Thread simendsjo
Given the header file mymodule.h: void f(void); I'm creating mymodule.d: extern(C) void f(); It works fine when compiling with this library, but when I compile with -unittest, I get undefined reference to ModuleInfo: sample.o:(.data+0x210): undefined reference to

Re: 2.058 broke my build. Is this a bug?

2012-02-24 Thread Dmitry Olshansky
On 24.02.2012 10:28, Caligo wrote: 88 import std.datetime : benchmark; import std.stdio : writefln; struct A(int r, int c){ public: alias float[r * c] Data; Data _data; auto opBinary(A a){ float t; foreach(i; 0..r*c)

Re: Compiling with -unittest on a c wrapper

2012-02-24 Thread simendsjo
On Fri, 24 Feb 2012 10:06:33 +0100, simendsjo simend...@gmail.com wrote: Given the header file mymodule.h: void f(void); I'm creating mymodule.d: extern(C) void f(); It works fine when compiling with this library, but when I compile with -unittest, I get undefined reference to ModuleInfo:

Re: D, Derelict2, and OpenGL

2012-02-24 Thread David
Am 24.02.2012 01:50, schrieb Chris Pons: Is the documentation up-to-date on this site? So that I can search through and try to learn more about a certain library and how it could help me? Which site? The derelict documentation? There is no real derelict documentation, but you normally dont

Re: SONAME and D

2012-02-24 Thread Jordi Sayol
Al 23/02/12 20:29, En/na bioinfornatics ha escrit: Le jeudi 23 février 2012 à 19:46 +0100, Mike Wey a écrit : On 02/23/2012 05:27 PM, bioinfornatics wrote: dear, for set soname with: - gdc: -Xlinker -soname myLib.so.1 - ldc2: -soname myLib.so.1 - dmd: ? someone know how set soname with

Re: SONAME and D

2012-02-24 Thread David
Am 24.02.2012 11:40, schrieb Jordi Sayol: Al 23/02/12 20:29, En/na bioinfornatics ha escrit: Le jeudi 23 février 2012 à 19:46 +0100, Mike Wey a écrit : On 02/23/2012 05:27 PM, bioinfornatics wrote: dear, for set soname with: - gdc: -Xlinker -soname myLib.so.1 - ldc2: -soname myLib.so.1 - dmd:

Re: SONAME and D

2012-02-24 Thread Jordi Sayol
Al 24/02/12 11:59, En/na David ha escrit: Are you able to build dynamic libraries directly with DMD? How? -sharedgenerate shared library I got this: $ dmd -fPIC -shared foo.d /usr/bin/ld: /usr/lib/libphobos2.a(minfo.o): relocation R_X86_64_32 against `.data' can not be used when

Re: Pure and higher-order functions

2012-02-24 Thread mist
Ok, finally understood. I was trying to declare hof like this: void f2( pure int function() param ) , similar to the way I declare usual pure functions. Looks like it is syntax error and only void f2( int function() pure param ) is allowed. That led me to false conclusion, that such

Re: Linking with d3d11.dll/lib

2012-02-24 Thread Sean Cavanaugh
On 2/23/2012 5:03 PM, John Burton wrote: I'm trying to use the d3d11 bindings in http://www.dsource.org/projects/bindings/wiki/DirectX to call direct3d11 functions from my D program. I've managed to get the code to compiler but when it links I get this error - Error 42 Symbol Undefined

Re: SONAME and D

2012-02-24 Thread Jordi Sayol
Al 24/02/12 11:59, En/na David ha escrit: Are you able to build dynamic libraries directly with DMD? How? -sharedgenerate shared library It compiles to 32-bit but fails for 64-bit, maybe due to compiled libphobos2 (64-bit) without -fPIC argument? Another thing. $ dmd -fPIC -shared

Re: fedora/ldc where are druntime headers?

2012-02-24 Thread bioinfornatics
Le jeudi 23 février 2012 à 18:35 -0600, Ellery Newcomer a écrit : grumph. is it not possible to fix the packages in repo? On 02/23/2012 05:17 PM, bioinfornatics wrote: get latest ldc build here: http://koji.fedoraproject.org/koji/buildinfo?buildID=299767 install it with yum install

About CTFE and pointers

2012-02-24 Thread bearophile
I have seen this C++11 program: http://kaizer.se/wiki/log/post/C++_constexpr/ I have translated it to this D code: bool notEnd(const char *s, const int n) { return s s[n]; } bool strPrefix(const char *s, const char *t, const int ns, const int nt) { return (s == t) || !t[nt]

Re: Pure and higher-order functions

2012-02-24 Thread bearophile
mist: Are there any reasons for this inconsistency? I don't know. Maybe it's just a parser bug. There are some of those in Bugzilla. If you don't like it, then I suggest you to add it to D Bugzilla. Bye, bearophile

Re: About CTFE and pointers

2012-02-24 Thread Alex Rønne Petersen
On 24-02-2012 15:08, bearophile wrote: I have seen this C++11 program: http://kaizer.se/wiki/log/post/C++_constexpr/ I have translated it to this D code: bool notEnd(const char *s, const int n) { return s s[n]; } bool strPrefix(const char *s, const char *t, const int ns, const int nt) {

Re: Linking with d3d11.dll/lib

2012-02-24 Thread John Burton
Thank you for checking. I'm guessing that the most likely problem then is that either my d3d11.lib file is broken, or the build is not finding it somehow... I'll check later. Thank you for confiruming it basically works :)

Re: SONAME and D

2012-02-24 Thread Mike Wey
On 02/23/2012 08:29 PM, bioinfornatics wrote: Le jeudi 23 février 2012 à 19:46 +0100, Mike Wey a écrit : On 02/23/2012 05:27 PM, bioinfornatics wrote: dear, for set soname with: - gdc: -Xlinker -soname myLib.so.1 - ldc2: -soname myLib.so.1 - dmd: ? someone know how set soname with dmd ?

Re: About CTFE and pointers

2012-02-24 Thread Don Clugston
On 24/02/12 15:18, Alex Rønne Petersen wrote: On 24-02-2012 15:08, bearophile wrote: I have seen this C++11 program: http://kaizer.se/wiki/log/post/C++_constexpr/ I have translated it to this D code: bool notEnd(const char *s, const int n) { return s s[n]; } bool strPrefix(const char *s,

Re: Pure and higher-order functions

2012-02-24 Thread mist
Actually, looks like you have done it already 2 years ago :) http://d.puremagic.com/issues/show_bug.cgi?id=4505

Re: D runtime Garbage Collector details

2012-02-24 Thread deadalnix
Le 24/02/2012 00:49, Vadim a écrit : I am looking for the details on D Garbage Collection implementation. I will much appreciate if someone suggests the answers or give some links to existing documentation clarifying the following points: 1. Is it Mark-n-Sweep or copy or generational collector

Re: GDC: how to link with alternate version of Phobos?

2012-02-24 Thread Jonathan M Davis
On Friday, February 24, 2012 09:43:30 Johannes Pfau wrote: try -nophoboslib and/or -nostdinc. However, to use the git phobos version with gdc you also have to compile it with gdc. I'm not sure but I think the phobos source in gdc has gdc specific changes, at least it's that way for druntime.

Using delegates in callbacks for extern(C) functions

2012-02-24 Thread simendsjo
I have a C function taking a callback function as a parameter. My thought was to wrap this up using a template, but I cannot get it to work: extern(C) alias void function() Callback; template Wrap(alias dg) { extern(C) void Wrap() { dg(); } } void main() { Callback cb

Re: SONAME and D

2012-02-24 Thread Ellery Newcomer
On 02/24/2012 06:27 AM, Jordi Sayol wrote: It compiles to 32-bit but fails for 64-bit, maybe due to compiled libphobos2 (64-bit) without -fPIC argument? What? -shared works with 32-bit? Holy crap, it does! this is awesome! maybe make a bug report for 64 bit?

Cannot cast void* to arrays..?

2012-02-24 Thread simendsjo
char[] a; auto b = cast(void*)a; auto c = cast(char[])b; // Error: e2ir: cannot cast b of type void* to type char[]

Re: SONAME and D

2012-02-24 Thread Jordi Sayol
Al 24/02/12 20:21, En/na Ellery Newcomer ha escrit: On 02/24/2012 06:27 AM, Jordi Sayol wrote: It compiles to 32-bit but fails for 64-bit, maybe due to compiled libphobos2 (64-bit) without -fPIC argument? What? -shared works with 32-bit? Holy crap, it does! this is awesome! maybe

Re: SONAME and D

2012-02-24 Thread H. S. Teoh
On Fri, Feb 24, 2012 at 08:36:03PM +0100, Jordi Sayol wrote: [...] better wait till libphobos2.a becomes libphobos2.so [...] You might have to wait a while for that. AFAIK there are no plans currently to make phobos available as a shared library yet. I personally think that phobos *should* be a

Re: Cannot cast void* to arrays..?

2012-02-24 Thread H. S. Teoh
On Fri, Feb 24, 2012 at 08:34:19PM +0100, simendsjo wrote: char[] a; auto b = cast(void*)a; auto c = cast(char[])b; // Error: e2ir: cannot cast b of type void* to type char[] D arrays are not the same as C arrays. D arrays also include length in addition to the pointer, so you

Re: Cannot cast void* to arrays..?

2012-02-24 Thread Justin Whear
On Fri, 24 Feb 2012 20:34:19 +0100, simendsjo wrote: char[] a; auto b = cast(void*)a; auto c = cast(char[])b; // Error: e2ir: cannot cast b of type void* to type char[] Arrays have a length--you need to cast the pointer to a char*, then slice it.

Re: Cannot cast void* to arrays..?

2012-02-24 Thread simendsjo
On Fri, 24 Feb 2012 20:42:20 +0100, Justin Whear jus...@economicmodeling.com wrote: On Fri, 24 Feb 2012 20:34:19 +0100, simendsjo wrote: char[] a; auto b = cast(void*)a; auto c = cast(char[])b; // Error: e2ir: cannot cast b of type void* to type char[] Arrays have a

Re: Cannot cast void* to arrays..?

2012-02-24 Thread Mantis
24.02.2012 21:34, simendsjo пишет: char[] a; auto b = cast(void*)a; auto c = cast(char[])b; // Error: e2ir: cannot cast b of type void* to type char[] Generally, you should not cast a struct to pointer and vise-versa. Besides, size of array structure is larger than size of

Re: Cannot cast void* to arrays..?

2012-02-24 Thread H. S. Teoh
24.02.2012 21:34, simendsjo пишет: char[] a; auto b = cast(void*)a; auto c = cast(char[])b; // Error: e2ir: cannot cast b of type void* to type char[] [...] Just out of curiosity, what are you trying to accomplish with this cast? In almost all normal D code, there's no need for

Re: Cannot cast void* to arrays..?

2012-02-24 Thread Ali Çehreli
On 02/24/2012 11:44 AM, simendsjo wrote: On Fri, 24 Feb 2012 20:42:20 +0100, Justin Whear jus...@economicmodeling.com wrote: On Fri, 24 Feb 2012 20:34:19 +0100, simendsjo wrote: char[] a; auto b = cast(void*)a; auto c = cast(char[])b; // Error: e2ir: cannot cast b of type void* to type

Re: Adding overloaded methods

2012-02-24 Thread H. S. Teoh
On Fri, Feb 24, 2012 at 04:24:03PM +1300, James Miller wrote: On 24 February 2012 12:06, H. S. Teoh hst...@quickfur.ath.cx wrote: On Fri, Feb 24, 2012 at 04:06:52AM +1300, James Miller wrote: On 23 February 2012 13:15, BLM blm...@gmail.com wrote: After messing around for a while, I figured

Re: mixin template FAIL

2012-02-24 Thread Zach the Mystic
On 2/23/12 7:33 PM, Ellery Newcomer wrote: import std.stdio; mixin template helpMe() { writeln(Satisfying!); } does it do that if you replace the statement with a declaration? like this: mixin template helpMe() { int durrr = (writeln(Satisfying!), 1); } No, it doesn't. You're right. I

Re: Cannot cast void* to arrays..?

2012-02-24 Thread simendsjo
On Fri, 24 Feb 2012 20:56:18 +0100, Ali Çehreli acehr...@yahoo.com wrote: On 02/24/2012 11:44 AM, simendsjo wrote: On Fri, 24 Feb 2012 20:42:20 +0100, Justin Whear jus...@economicmodeling.com wrote: On Fri, 24 Feb 2012 20:34:19 +0100, simendsjo wrote: char[] a; auto b = cast(void*)a; auto

Re: Cannot cast void* to arrays..?

2012-02-24 Thread simendsjo
On Fri, 24 Feb 2012 20:56:22 +0100, H. S. Teoh hst...@quickfur.ath.cx wrote: 24.02.2012 21:34, simendsjo пишет: char[] a; auto b = cast(void*)a; auto c = cast(char[])b; // Error: e2ir: cannot cast b of type void* to type char[] [...] Just out of curiosity, what are you trying to

Re: Cannot cast void* to arrays..?

2012-02-24 Thread H. S. Teoh
On Fri, Feb 24, 2012 at 11:56:18AM -0800, Ali Çehreli wrote: [...] char[1] a; auto c = a.ptr[0..a.length]; [...] Hey, that's an awesome way to implement copy-on-write static arrays! I'll have to use that sometime. :) T -- Sometimes the best solution to morale problems is just to

Re: mixin template FAIL

2012-02-24 Thread H. S. Teoh
On Fri, Feb 24, 2012 at 03:08:18PM -0500, Zach the Mystic wrote: [...] Does any other language come close to D in terms of generics? I don't know, I'm just asking? [...] AFAIK, no. But then I only have C++ to compare with, and if I understand it correctly Java and C#'s generics don't even come

Re: Cannot cast void* to arrays..?

2012-02-24 Thread Andrej Mitrovic
On 2/24/12, simendsjo simend...@gmail.com wrote: I don't get it. This gives me a dynamic array, not a static: char[1] a; auto b = cast(void*)a; auto c = (cast(char*)b)[0..1]; c.length = 10; // auch! You can do: char[1] c = (cast(char*)b)[0..1];

Re: SONAME and D

2012-02-24 Thread Jordi Sayol
Al 24/02/12 20:45, En/na H. S. Teoh ha escrit: On Fri, Feb 24, 2012 at 08:36:03PM +0100, Jordi Sayol wrote: [...] better wait till libphobos2.a becomes libphobos2.so [...] You might have to wait a while for that. AFAIK there are no plans currently to make phobos available as a shared

Re: SONAME and D

2012-02-24 Thread H. S. Teoh
On Fri, Feb 24, 2012 at 09:35:57PM +0100, Jordi Sayol wrote: Al 24/02/12 20:45, En/na H. S. Teoh ha escrit: [...] I personally think that phobos *should* be a shared object at some point, but not everyone agrees with me. I think that phobos should be a shared object too, but only when

deh_end

2012-02-24 Thread Ellery Newcomer
So I'm all trying out this hot new shared switch, and it works just dandy for -m32 when d has the main function. But now I want to be able to call my shared lib from C. my little shared lib, tup.d: import std.stdio; extern(C) void xyz(int i){ writeln(i); } compiled like so: dmd

Re: Cannot cast void* to arrays..?

2012-02-24 Thread simendsjo
On Fri, 24 Feb 2012 21:36:21 +0100, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: On 2/24/12, simendsjo simend...@gmail.com wrote: I don't get it. This gives me a dynamic array, not a static: char[1] a; auto b = cast(void*)a; auto c = (cast(char*)b)[0..1]; c.length =

Re: 2.058 broke my build. Is this a bug?

2012-02-24 Thread Caligo
That was a typo, and it doesn't change anything. Here is a shorter version: 88 import std.datetime; import std.stdio; struct A{ auto fun(A a){ return 0; } } void bench(alias fun)(string msg, uint n = 1_000_000){ auto b = benchmark!fun(n);

Re: mixin template FAIL

2012-02-24 Thread James Miller
On Feb 25, 2012 9:08 AM, Zach the Mystic reachzachatgooglesmailserv...@dot.com wrote: On 2/23/12 7:33 PM, Ellery Newcomer wrote: import std.stdio; mixin template helpMe() { writeln(Satisfying!); } does it do that if you replace the statement with a declaration? like this: mixin

Re: 2.058 broke my build. Is this a bug?

2012-02-24 Thread James Miller
On Feb 25, 2012 12:16 PM, Caligo iteronve...@gmail.com wrote: That was a typo, and it doesn't change anything. Here is a shorter version: 88 import std.datetime; import std.stdio; struct A{ auto fun(A a){ return 0; } } void bench(alias

Re: 2.058 broke my build. Is this a bug?

2012-02-24 Thread Caligo
Is there another workaround than the one I've posted? http://d.puremagic.com/issues/show_bug.cgi?id=7577 On Fri, Feb 24, 2012 at 8:44 PM, James Miller ja...@aatch.net wrote: Hmm it seems that the delegate is being implicitly marked as system, and im not sure why benchmark is @safe. I'd say

Re: std.net.curl not working in 2.058 for Windows

2012-02-24 Thread Brad Anderson
On Friday, 24 February 2012 at 08:47:14 UTC, Brad Anderson wrote: On Friday, 24 February 2012 at 07:59:50 UTC, Brad Anderson wrote: There is no documentation (both on dlang.org and in the local documentation) so I'm not sure if it's supposed to be working yet. I get linker errors when I try

Re: 2.058 broke my build. Is this a bug?

2012-02-24 Thread Caligo
I found another workaround: mark the module as trusted.

struct init() method

2012-02-24 Thread bearophile
This program comes from a reduction of a bug I've found: struct Foo { void init() {} } void main() { Foo*[] foos; //(*foos[0]).init(); // OK foos[0].init(); // Error: function expected before (), not null of type Foo* } What do you think about the idea of not allowing methods