Re: Can DUB --combined builds be faster?

2016-03-14 Thread Chris Wright via Digitalmars-d-learn
On Tue, 15 Mar 2016 01:54:51 +, thedeemon wrote:

> On Monday, 14 March 2016 at 11:50:38 UTC, Rene Zwanenburg wrote:
> 
>> When building in release mode the call to foo() gets inlined just fine
>> without --combined.
> 
> How does it work? Is it because the source of foo() is visible to the
> compiler when producing the result?

Yes.


Re: Can DUB --combined builds be faster?

2016-03-14 Thread thedeemon via Digitalmars-d-learn

On Monday, 14 March 2016 at 11:50:38 UTC, Rene Zwanenburg wrote:

When building in release mode the call to foo() gets inlined 
just fine without --combined.


How does it work? Is it because the source of foo() is visible to 
the compiler when producing the result?


Re: Not sure how to translate this C++ variable to D.

2016-03-14 Thread Ali Çehreli via Digitalmars-d-learn

On 03/14/2016 03:14 PM, WhatMeWorry wrote:
>
>  sprite_renderer.h --
>
> class SpriteRenderer
> {
> ...
> };

Same thing in D without the semicolon. :)

>  game.cpp 
>
> #include "sprite_renderer.h"
>
> SpriteRenderer  *Renderer;

Like in Java and C#, class variables are object references in D. So, the 
following is sufficient:


SpriteRenderer Renderer;  // Although, I would name it 'renderer'

However, unlike C++, that variable is thread-local, meaning that if you 
have more than one thread, each will have their own variable. If you 
really need it, in multithreaded code you may want to define it shared:


shared(SpriteRenderer) renderer;

But then you will have to deal with thread synchronization.

> I tried taking due diligence with the documentation.

There is something here:

  http://ddili.org/ders/d.en/class.html#ix_class.variable,%20class

Ali



Re: Can DUB --combined builds be faster?

2016-03-14 Thread Guillaume Piolat via Digitalmars-d-learn

On Monday, 14 March 2016 at 11:50:38 UTC, Rene Zwanenburg wrote:


It shouldn't make a difference for the resulting executable, 
but compilation itself may be faster. I did a little test just 
to be sure. Two DUB packages, one with:


module m;
string foo() { return "asdf"; }

And the other:
import m;
import std.stdio;
void main() { writeln(foo()); }

When building in release mode the call to foo() gets inlined 
just fine without --combined.


Thanks for the test!


Not sure how to translate this C++ variable to D.

2016-03-14 Thread WhatMeWorry via Digitalmars-d-learn


 sprite_renderer.h --

class SpriteRenderer
{
...
};

 game.cpp 

#include "sprite_renderer.h"

SpriteRenderer  *Renderer;

Game::Game(GLuint width, GLuint height)
: State(GAME_ACTIVE), Keys(), Width(width), Height(height)
{
  ...
}

---

What is the best (or any) approach for translating SpriteRenderer 
*Renderer;

to D?  Thanks.

Sorry if this is common knowledge.  I tried taking due diligence 
with the documentation.


Re: Sort using Uniform call syntax

2016-03-14 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, March 14, 2016 11:27:30 Ali Çehreli via Digitalmars-d-learn wrote:
> On 03/14/2016 06:56 AM, Jonathan M Davis via Digitalmars-d-learn wrote:
> > On Monday, March 14, 2016 04:14:26 Ali Çehreli via Digitalmars-d-learn 
wrote:
> >> On 03/14/2016 04:01 AM, Jerry wrote:
> >>   > I have a small problem with using UCS when sorting arrays. This pops
> >>   > a
> >>   > warning telling me to use the algorithm sort instead of the property
> >>   > sort. Which I understand why it works that way. However that means I
> >>   > can
> >>   > not have syntactic sugar. So is there any way around this or do I
> >>   > just
> >>   > have to live with it?
> >>
> >> Two options:
> >>
> >> a) Use parentheses after sort:
> >>   arr.sort()
> >>
> >> b) Import sort() under a different name:
> >>
> >> import std.algorithm: algsort = sort;
> >>
> >>   arr.algsort
> >
> > Yep. The sort property on arrays will likely go away eventually, but until
> > it does, those are your options. But at least now it warns you.
> > Previously,
> > it just silently used the sort property, which does the wrong thing for
> > arrays of char or wchar.
> >
> > - Jonathan M Davis
>
> Do you mean property sort would sort individual chars? However, the
> following program indicates that it may have been fixed (i.e. made
> Unicode-aware):

It was my understanding that the built-in sort did indeed sort individual
chars, so if that's not currently the case, I expect that someone fixed it
at some point. Still, it should be removed from the language at some point.

- Jonathan M Davis




Re: Sort using Uniform call syntax

2016-03-14 Thread Ali Çehreli via Digitalmars-d-learn

On 03/14/2016 06:56 AM, Jonathan M Davis via Digitalmars-d-learn wrote:

On Monday, March 14, 2016 04:14:26 Ali Çehreli via Digitalmars-d-learn wrote:

On 03/14/2016 04:01 AM, Jerry wrote:
  > I have a small problem with using UCS when sorting arrays. This pops a
  > warning telling me to use the algorithm sort instead of the property
  > sort. Which I understand why it works that way. However that means I can
  > not have syntactic sugar. So is there any way around this or do I just
  > have to live with it?

Two options:

a) Use parentheses after sort:

  arr.sort()

b) Import sort() under a different name:

import std.algorithm: algsort = sort;

  arr.algsort


Yep. The sort property on arrays will likely go away eventually, but until
it does, those are your options. But at least now it warns you. Previously,
it just silently used the sort property, which does the wrong thing for
arrays of char or wchar.

- Jonathan M Davis


Do you mean property sort would sort individual chars? However, the 
following program indicates that it may have been fixed (i.e. made 
Unicode-aware):


import std.stdio;

void main() {
auto arr = "çöüabc".dup;
arr.sort;

// (Not correct for a particular writing system but
// that's beyond the point. It's still a correct string.)
assert(arr == "abcçöü");

foreach (c; arr) {
writefln("%02x", c);
}
}

Prints:

61
62
63
c3 <- Out of order
a7 <- etc.
c3
b6
c3
bc

Perhaps, this was an independent change? More likely I've misunderstood 
you. :)


Ali



Re: Gdmd compiling error

2016-03-14 Thread Ali Çehreli via Digitalmars-d-learn

On 03/14/2016 10:08 AM, Marc Schütz wrote:

> What does `which gdc` print? If it says something like "which: no gdc in
> ...", there is a problem with the installation of GDC. Otherwise, you
> can use the following as a quick workaround:
>
>  sudo ln -s `which gdc` /usr/local/bin/gdc
>
> The proper solution is to find out why gdmd insists on using that
> non-existing path instead of relying on $PATH lookup, and fix it.

Apparently, gdmd expects gdc to be in the same directory as itself. Once 
Orkhan finds out where gdc is on the system, the following should work:


$ sudo ln -s 
/home/acehreli/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gdc 
/usr/local/bin/gdc


Orkhan, replace 
/home/acehreli/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gdc with the 
gdc binary that you have. e.g. if it's under /usr/bin, then do the 
following:


$ sudo ln -s /usr/bin/gdc /usr/local/bin/gdc

Ali

P.S. I've just installed gdc after downloading it from its download site 
( http://gdcproject.org/downloads ) with the following two commands:


  unxz the_file_you_downloaded
  tar xvf the_file_you_unxzipped

Those commands created the following directory in my case.

  /home/acehreli/x86_64-pc-linux-gnu

That's why my gdc is named 
/home/acehreli/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gdc above.




Re: Gdmd compiling error

2016-03-14 Thread Marc Schütz via Digitalmars-d-learn

On Monday, 14 March 2016 at 14:46:06 UTC, Orkhan wrote:

On Monday, 14 March 2016 at 11:11:28 UTC, Ali Çehreli wrote:

On 03/14/2016 02:56 AM, Orkhan wrote:

> THe output like that :
> root@ubuntu:/opt/xcomm# gdmd
> Can't exec "/usr/local/bin/gdc": No such file or directory at

Ok, now you need to install gdc:

  http://gdcproject.org/downloads

In short, the project that you are trying to build depends on 
gdmd, which is a dmd-like interface to gdc, which needs to be 
installed on your system.


Ali


Dear Ali ,
Thanks for your answer and time.
I have tried to install and the output was like that. I gues it 
is already installed in my linux. isnt it ?


root@ubuntu:/opt/xcomm# sudo apt-get install gdc
Reading package lists... Done
Building dependency tree
Reading state information... Done
gdc is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 180 not upgraded.
root@ubuntu:/opt/xcomm#

It is very urgent for me to install the project , I hope will 
do with your help .

Thanks.


What does `which gdc` print? If it says something like "which: no 
gdc in ...", there is a problem with the installation of GDC. 
Otherwise, you can use the following as a quick workaround:


sudo ln -s `which gdc` /usr/local/bin/gdc

The proper solution is to find out why gdmd insists on using that 
non-existing path instead of relying on $PATH lookup, and fix it.


Re: Where do I learn to use GtkD

2016-03-14 Thread Gerald via Digitalmars-d-learn

On Monday, 14 March 2016 at 07:38:43 UTC, Russel Winder wrote:
What we need here is a collection of people reviewing each 
others GtkD code and having a listing board somewhere on the 
GtkD site of all the codes available and what they show. It is 
the annotations as much as the code itself that is needed for 
learning.


Without comparative review, we may end up propagating bad code 
and bad GTK use.


So rather than just email as here, we should be looking to 
create a "living document" on the wiki – not an historical type 
thing but an always up-to-date, curated document.


I have some generic GtkD code in Terminix of varying quality that 
at some point in the future I want to move to a library in order 
to re-use it between my projects. This code mostly consists of 
helpers or things that make working with GtkD more D'ish, i.e 
enabling the use of foreach to iterate over a TreeModel/TreeIter.


Having said that, I don't have the time to take on the role of 
being the primary maintainer for such a library, if you want to 
take it on though I'm happy to be an active contributor.


Re: Gdmd compiling error

2016-03-14 Thread Orkhan via Digitalmars-d-learn

On Monday, 14 March 2016 at 11:11:28 UTC, Ali Çehreli wrote:

On 03/14/2016 02:56 AM, Orkhan wrote:

> THe output like that :
> root@ubuntu:/opt/xcomm# gdmd
> Can't exec "/usr/local/bin/gdc": No such file or directory at

Ok, now you need to install gdc:

  http://gdcproject.org/downloads

In short, the project that you are trying to build depends on 
gdmd, which is a dmd-like interface to gdc, which needs to be 
installed on your system.


Ali


Dear Ali ,
Thanks for your answer and time.
I have tried to install and the output was like that. I gues it 
is already installed in my linux. isnt it ?


root@ubuntu:/opt/xcomm# sudo apt-get install gdc
Reading package lists... Done
Building dependency tree
Reading state information... Done
gdc is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 180 not upgraded.
root@ubuntu:/opt/xcomm#

It is very urgent for me to install the project , I hope will do 
with your help .

Thanks.


Re: std.stdio.File.seek error

2016-03-14 Thread Mike Parker via Digitalmars-d-learn

On Monday, 14 March 2016 at 14:19:27 UTC, stunaep wrote:



I'm on my phone but I think It said something like
Deprecation: module std.stdio not accessible from here. Try 
import static std.stdio


Deprecation: module std.stdio is not accessible here, perhaps add 
'static import std.stdio;'


The solution is right there in the error message. Change your 
import from whatever it is now to a static one. See [1].


[1] http://forum.dlang.org/thread/1835132.hmAZsairJU@lyonel


Re: std.stdio.File.seek error

2016-03-14 Thread Kagamin via Digitalmars-d-learn

On Monday, 14 March 2016 at 14:19:27 UTC, stunaep wrote:

I'm on my phone but I think It said something like
Deprecation: module std.stdio not accessible from here. Try 
import static std.stdio


That's fix for bug https://issues.dlang.org/show_bug.cgi?id=313
See the code where std.stdio is not accessible from.


Re: std.stdio.File.seek error

2016-03-14 Thread stunaep via Digitalmars-d-learn

On Monday, 14 March 2016 at 13:33:36 UTC, Mike Parker wrote:

On Monday, 14 March 2016 at 09:57:19 UTC, stunaep wrote:

It looks like _fseeki64 is in the nightly build but not dmd 
2.070.2; However, the nightly build says std.stdio and 
std.conv are deprecated and I cant use them.


I think you may be misinterpreting the error message. There was 
a change recently in how imports are handled in certain cases 
and that may be what you're seeing. What exactly is the error 
message?


I'm on my phone but I think It said something like
Deprecation: module std.stdio not accessible from here. Try 
import static std.stdio


Re: Sort using Uniform call syntax

2016-03-14 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, March 14, 2016 04:14:26 Ali Çehreli via Digitalmars-d-learn wrote:
> On 03/14/2016 04:01 AM, Jerry wrote:
>  > I have a small problem with using UCS when sorting arrays. This pops a
>  > warning telling me to use the algorithm sort instead of the property
>  > sort. Which I understand why it works that way. However that means I can
>  > not have syntactic sugar. So is there any way around this or do I just
>  > have to live with it?
>
> Two options:
>
> a) Use parentheses after sort:
>
>  arr.sort()
>
> b) Import sort() under a different name:
>
> import std.algorithm: algsort = sort;
>
>  arr.algsort

Yep. The sort property on arrays will likely go away eventually, but until
it does, those are your options. But at least now it warns you. Previously,
it just silently used the sort property, which does the wrong thing for
arrays of char or wchar.

- Jonathan M Davis




Re: Specialized template in different module

2016-03-14 Thread Mike Parker via Digitalmars-d-learn

On Monday, 14 March 2016 at 08:42:58 UTC, John wrote:
If I define a template in one module, and specialize it in a 
second module, the compiler doesn't like it when I try to call 
a function using the template.


If I put everything in the same module it works. So are 
template specializations limited to the same module?


Package and module names are mangled into symbol names, which 
means templates declare in different modules will always be 
different templates. It's what allows you to disambiguate between 
conflicting symbols.


Re: std.stdio.File.seek error

2016-03-14 Thread Mike Parker via Digitalmars-d-learn

On Monday, 14 March 2016 at 09:57:19 UTC, stunaep wrote:

It looks like _fseeki64 is in the nightly build but not dmd 
2.070.2; However, the nightly build says std.stdio and std.conv 
are deprecated and I cant use them.


I think you may be misinterpreting the error message. There was a 
change recently in how imports are handled in certain cases and 
that may be what you're seeing. What exactly is the error message?


Re: Can DUB --combined builds be faster?

2016-03-14 Thread Rene Zwanenburg via Digitalmars-d-learn

On Monday, 14 March 2016 at 11:03:41 UTC, Guillaume Piolat wrote:
I'm cargo-culting the use of --combined with DUB because I 
somehow think inlining will be better in this way. (For thos 
who don't use DUB, what it does is compiling the whole program 
with a single compiler invokation instead of making one static 
library by package.)


But I've never measured much speed-up that way so I wonder if 
it's a dumb thing to do.


Is there a theoretical reason --combined builds may be faster?


It shouldn't make a difference for the resulting executable, but 
compilation itself may be faster. I did a little test just to be 
sure. Two DUB packages, one with:


module m;
string foo() { return "asdf"; }

And the other:
import m;
import std.stdio;
void main() { writeln(foo()); }

When building in release mode the call to foo() gets inlined just 
fine without --combined.


Re: Using tango or other static lib in static lib

2016-03-14 Thread Voitech via Digitalmars-d-learn

On Sunday, 13 March 2016 at 01:08:29 UTC, Mike Parker wrote:

On Sunday, 13 March 2016 at 01:06:33 UTC, Mike Parker wrote:

it. Assuming both files live in the same directory, they can 
be compiled with this command:


Somehow I deleted that line:

dmd main.d something.d


Wow. Thank You very much for so wide description! I will try it 
and see if have any more questions.

Cheers


Re: Sort using Uniform call syntax

2016-03-14 Thread Ali Çehreli via Digitalmars-d-learn

On 03/14/2016 04:01 AM, Jerry wrote:
> I have a small problem with using UCS when sorting arrays. This pops a
> warning telling me to use the algorithm sort instead of the property
> sort. Which I understand why it works that way. However that means I can
> not have syntactic sugar. So is there any way around this or do I just
> have to live with it?

Two options:

a) Use parentheses after sort:

arr.sort()

b) Import sort() under a different name:

import std.algorithm: algsort = sort;

arr.algsort

Ali



Re: Gdmd compiling error

2016-03-14 Thread Ali Çehreli via Digitalmars-d-learn

On 03/14/2016 02:56 AM, Orkhan wrote:

> THe output like that :
> root@ubuntu:/opt/xcomm# gdmd
> Can't exec "/usr/local/bin/gdc": No such file or directory at

Ok, now you need to install gdc:

  http://gdcproject.org/downloads

In short, the project that you are trying to build depends on gdmd, 
which is a dmd-like interface to gdc, which needs to be installed on 
your system.


Ali



Can DUB --combined builds be faster?

2016-03-14 Thread Guillaume Piolat via Digitalmars-d-learn
I'm cargo-culting the use of --combined with DUB because I 
somehow think inlining will be better in this way. (For thos who 
don't use DUB, what it does is compiling the whole program with a 
single compiler invokation instead of making one static library 
by package.)


But I've never measured much speed-up that way so I wonder if 
it's a dumb thing to do.


Is there a theoretical reason --combined builds may be faster?


Sort using Uniform call syntax

2016-03-14 Thread Jerry via Digitalmars-d-learn
I have a small problem with using UCS when sorting arrays. This 
pops a warning telling me to use the algorithm sort instead of 
the property sort. Which I understand why it works that way. 
However that means I can not have syntactic sugar. So is there 
any way around this or do I just have to live with it?


Re: Specialized template in different module

2016-03-14 Thread ag0aep6g via Digitalmars-d-learn

On 14.03.2016 09:42, John wrote:

   module one;

   struct Test(T) {}

   void testing(T)(Test!T t) {}

   module two;

   struct Test(T : int) {}

   void main() {
 Test!int i;
 testing!int(i);
   }

Output:
   error : testing (Test!int t) is not callable using argument types
(Test!int)

If I put everything in the same module it works. So are template
specializations limited to the same module?


The two `Test` templates are completely unrelated to each other. 
`one.testing` only accepts `one.Test`, it isn't aware of `two.Test` at all.


You can bring them together with `alias`:


module one;
static import two;

alias Test = two.Test;
struct Test(T) {}

void testing(T)(Test!T t) {}


`one.testing` still only accepts `one.Test`, but `one.Test` now includes 
`two.Test`, so it works.


Sadly, dmd doesn't like it when you put the alias line behind the struct 
line. I think that's a bug. Filed it here:

https://issues.dlang.org/show_bug.cgi?id=15795


Re: Gdmd compiling error

2016-03-14 Thread Ali Çehreli via Digitalmars-d-learn

On 03/14/2016 02:29 AM, Orkhan wrote:

> root@ubuntu:/home/alikoza/Downloads/GDMD-master# sudo make install
> rm -f /usr/local/bin/gdmd
> install dmd-script /usr/local/bin/gdmd

Good: gdmd seems to be installed. Please type 'gdmd' to confirm.

Note: You may see errors like 'Can't exec "/usr/local/bin/gdc":' but 
that's a separate issue, which will be resolved by installing gdc.


> rm -f /usr/local/share/man/man1/gdmd.1
> install -m 644 dmd-script.1 /usr/local/share/man/man1/gdmd.1
> install: cannot create regular file ‘/usr/local/share/man/man1/gdmd.1’:
> No such file or directory

Luckily, that seems to be a problem with the man page for this tool. I 
presume the installation assumes a certain directory hierarchy which is 
not present on your system. You can ignore that error. You may want to 
create a bug report on gdmd's project page at github.


Ali



Re: std.stdio.File.seek error

2016-03-14 Thread stunaep via Digitalmars-d-learn

On Monday, 14 March 2016 at 07:15:01 UTC, Nicholas Wilson wrote:

On Monday, 14 March 2016 at 05:24:48 UTC, stunaep wrote:
On Monday, 14 March 2016 at 03:07:05 UTC, Nicholas Wilson 
wrote:

[...]


I'm currently on windows 7. The code you gave me prints 022. 
It's weird because it always tries to convert longs to ints 
and I think that is weird because the function uses a c_long.

[...]


It wont even compile if I try giving it a long

[...]


I also tried giving it a c_long, but this line

[...]

gives this error for some reason...

[...]


It's like c_longs are not longs at all...


c_long maps to the target long which evidently is not 64-bit on 
win7

meaning you can't seek longer than int.max.
 if you cant't find _fseeki64 try looking in the windows 
section.

Glad you got it working on arch.

Nic


It looks like _fseeki64 is in the nightly build but not dmd 
2.070.2; However, the nightly build says std.stdio and std.conv 
are deprecated and I cant use them.


Re: Gdmd compiling error

2016-03-14 Thread Orkhan via Digitalmars-d-learn

On Monday, 14 March 2016 at 09:48:00 UTC, Ali Çehreli wrote:

On 03/14/2016 02:29 AM, Orkhan wrote:

> root@ubuntu:/home/alikoza/Downloads/GDMD-master# sudo make
install
> rm -f /usr/local/bin/gdmd
> install dmd-script /usr/local/bin/gdmd

Good: gdmd seems to be installed. Please type 'gdmd' to confirm.

Note: You may see errors like 'Can't exec 
"/usr/local/bin/gdc":' but that's a separate issue, which will 
be resolved by installing gdc.


> rm -f /usr/local/share/man/man1/gdmd.1
> install -m 644 dmd-script.1 /usr/local/share/man/man1/gdmd.1
> install: cannot create regular file
‘/usr/local/share/man/man1/gdmd.1’:
> No such file or directory

Luckily, that seems to be a problem with the man page for this 
tool. I presume the installation assumes a certain directory 
hierarchy which is not present on your system. You can ignore 
that error. You may want to create a bug report on gdmd's 
project page at github.


Ali


Thank you for your answer.
THe output like that :
root@ubuntu:/opt/xcomm# gdmd
Can't exec "/usr/local/bin/gdc": No such file or directory at 
/usr/local/bin/gdmd line 236.
Use of uninitialized value $gcc_version in scalar chomp at 
/usr/local/bin/gdmd line 237.
Use of uninitialized value $gcc_version in pattern match (m//) at 
/usr/local/bin/gdmd line 238.
Can't exec "/usr/local/bin/gdc": No such file or directory at 
/usr/local/bin/gdmd line 523.


What should I do make the dir which mentioned or ?
Thkanks



Re: Gdmd compiling error

2016-03-14 Thread Ali Çehreli via Digitalmars-d-learn

On 03/14/2016 02:15 AM, Orkhan wrote:


>> I think you need to install gdmd:
>>
>>   https://github.com/D-Programming-GDC/GDMD



Yes I have seen that page. But I don't know how to make that . I think I
need to upload all files then unzip then just type make ? could you
please let me know. Thanks.


1) Click [ Download ZIP ] to download all files

2) Unzip in some directory

3) Goto GDMD-master under that directory, e.g.

$ cd ~/GDMD-master/

4) make install under that directory as super user

$ sudo make install

Of course, gdmd relies on gdc, which you may have to install separately:

  http://dlang.org/download.html

Ali



Re: Gdmd compiling error

2016-03-14 Thread Orkhan via Digitalmars-d-learn

On Monday, 14 March 2016 at 09:24:19 UTC, Ali Çehreli wrote:

On 03/14/2016 02:15 AM, Orkhan wrote:


>> I think you need to install gdmd:
>>
>>   https://github.com/D-Programming-GDC/GDMD


Yes I have seen that page. But I don't know how to make that . 
I think I
need to upload all files then unzip then just type make ? 
could you

please let me know. Thanks.


1) Click [ Download ZIP ] to download all files

2) Unzip in some directory

3) Goto GDMD-master under that directory, e.g.

$ cd ~/GDMD-master/

4) make install under that directory as super user

$ sudo make install

Of course, gdmd relies on gdc, which you may have to install 
separately:


  http://dlang.org/download.html

Ali


Thank you for your answer. I have done what you said exactly . 
The output is like that :

root@ubuntu:/home/alikoza/Downloads/GDMD-master# sudo make install
rm -f /usr/local/bin/gdmd
install dmd-script /usr/local/bin/gdmd
rm -f /usr/local/share/man/man1/gdmd.1
install -m 644 dmd-script.1 /usr/local/share/man/man1/gdmd.1
install: cannot create regular file 
‘/usr/local/share/man/man1/gdmd.1’: No such file or directory
Makefile:41: recipe for target '/usr/local/share/man/man1/gdmd.1' 
failed

make: [/usr/local/share/man/man1/gdmd.1] Error 1 (ignored)




Re: Gdmd compiling error

2016-03-14 Thread Orkhan via Digitalmars-d-learn

On Monday, 14 March 2016 at 09:06:30 UTC, Ali Çehreli wrote:

On 03/14/2016 02:01 AM, Orkhan wrote:

> I changed all gdmd to dmd and still not getting result . the
outputs
> after changing dmd is :
>

> Error: unrecognized switch '-q,-rdynamic'

Sorry to have misled you. Apparently, those are gcc compiler 
switches that are not supported by dmd.


> On Monday, 14 March 2016 at 07:52:18 UTC, Ali Çehreli wrote:

>> I think you need to install gdmd:
>>
>>   https://github.com/D-Programming-GDC/GDMD

That's the only solution then.

Ali


Yes I have seen that page. But I don't know how to make that . I 
think I need to upload all files then unzip then just type make ? 
could you please let me know. Thanks.




Re: Gdmd compiling error

2016-03-14 Thread Ali Çehreli via Digitalmars-d-learn

On 03/14/2016 02:01 AM, Orkhan wrote:

> I changed all gdmd to dmd and still not getting result . the outputs
> after changing dmd is :
>

> Error: unrecognized switch '-q,-rdynamic'

Sorry to have misled you. Apparently, those are gcc compiler switches 
that are not supported by dmd.


> On Monday, 14 March 2016 at 07:52:18 UTC, Ali Çehreli wrote:

>> I think you need to install gdmd:
>>
>>   https://github.com/D-Programming-GDC/GDMD

That's the only solution then.

Ali



Re: Gdmd compiling error

2016-03-14 Thread Orkhan via Digitalmars-d-learn

On Monday, 14 March 2016 at 07:52:18 UTC, Ali Çehreli wrote:

On 03/13/2016 06:07 AM, Orkhan wrote:

> It is in linux system , and when I type make command it
returns error like:
> /bin/sh: 1: gdmd: not found

I think you need to install gdmd:

  https://github.com/D-Programming-GDC/GDMD

Alternatively, assuming that you have dmd installed, you can 
try replacing gdmd with dmd in your Makefile.


Ali


I changed all gdmd to dmd and still not getting result . the 
outputs after changing dmd is :


root@ubuntu:/opt/xcomm# make
dmd -O -inline -Isrc -version=daemon -op -of./xcomm 
src/misc_util.d src/socket_base.d src/xcomm_sockets.d 
src/msgserver_core.d src/char_outbuffer.d src/logging.d 
src/xml_util.d src/plugins.d src/xcomm_protocol/*.d src/stork/*.d 
src/stork/*/*.d -fPIC -q,-rdynamic -L-ldl

Error: unrecognized switch '-q,-rdynamic'
Makefile:35: recipe for target 'protocol-daemon' failed
make: *** [protocol-daemon] Error 1

the all server files are in here :
http://www.speedyshare.com/6y4Tv/47d2b57d/xcom.zip

could you please check . Thanks in advance.




Specialized template in different module

2016-03-14 Thread John via Digitalmars-d-learn
If I define a template in one module, and specialize it in a 
second module, the compiler doesn't like it when I try to call a 
function using the template.


  module one;

  struct Test(T) {}

  void testing(T)(Test!T t) {}

  module two;

  struct Test(T : int) {}

  void main() {
Test!int i;
testing!int(i);
  }

Output:
  error : testing (Test!int t) is not callable using argument 
types (Test!int)


If I put everything in the same module it works. So are template 
specializations limited to the same module?


Re: Programming in D vs The D Programming Language

2016-03-14 Thread Saša Janiška via Digitalmars-d-learn
Ali Çehreli  writes:

> I agree and I doubt that I will ever see PinD on a local bookshop
> shelf. What I meant was, IngramSpark makes it *possible* at all for a
> local bookshop to order the book for you and that you can return it
> for a full refund.

Now I'm living in much smaller place and will ask about the possibilities
to order, although I remember when I was living in the capital (Zagreb),
ordering from the shop ended up as double expensive in comparison with
e.g. Amazon order.

> * Because they boycot CreateSpace due to its affiliation with Amazon,
> a local bookstore will not store books printed by CreateSpace. This is
> because the wholesale discount is too little from CreateSpace and
> local book stores do not agree with certain practices of Amazon's book
> business.

I'm also not excited with the their business behaviour, but, otoh, do
not have much choices except using some other online retailer.

> * They will still order for you a book by CreateSpace only if you pay
> up front and if you understand that the book is not returnable.
> (Because CreateSpace books are simply not returnable.)

Ahh, I se..

> On the other hand, if the local book store orders the book from
> IngramSpark, then you need not prepay and you (and the bookstore) can
> return it.

I'm just curious if the above applies here. ;)

> So, I really think that your local bookstore will order one of the
> IngramSpark printing. And you will not pay for customs or shipping.

It sounds good, although I'm taking it with pinch of salt until I check
it out.

> 11 hours by car to Berlin seems a little long for you but there must
> be trains in Europe. ;)

There are nice trains in Europe, but poor connections in Croatia.

> I hope you and many others can make it. So many good friends here...

There are other circumstances to overcome (taking care of our small
daughter, while wife is working at emergency and you might heard there
is lack of doctors here and they have to work extra hours etc.)

However, let me thank you for the book which I know, from personal
epxerience, is always a labour of love and cannot be properly paid back,
but, at least, be happy that it created one new (old) user. ;)


Sincerely,
Gour

p.s. I'll inform you about my decision from where to get the book.

-- 
Bewildered by the modes of material nature, the ignorant fully
engage themselves in material activities and become attached. But
the wise should not unsettle them, although these duties are inferior
due to the performers' lack of knowledge.


Re: Gdmd compiling error

2016-03-14 Thread Ali Çehreli via Digitalmars-d-learn

On 03/13/2016 06:07 AM, Orkhan wrote:

> It is in linux system , and when I type make command it returns error 
like:

> /bin/sh: 1: gdmd: not found

I think you need to install gdmd:

  https://github.com/D-Programming-GDC/GDMD

Alternatively, assuming that you have dmd installed, you can try 
replacing gdmd with dmd in your Makefile.


Ali



Re: Where do I learn to use GtkD

2016-03-14 Thread Russel Winder via Digitalmars-d-learn
On Sun, 2016-03-13 at 19:28 +, karabuta via Digitalmars-d-learn
wrote:
> Gtk3 from python3 has got I nice book with examples that are not 
> so advanced but enough to get you doing real work(from a beginner 
> point of view). GtkD seem to have changed the API structure 
> compared to python3 Gtk3 and the demo examples just "show-off" 
> IMO :). The documentation is really^ not good :)

Each programming language will have a slightly different idiomatic way
of working with GObject introspection, so it is no surprise that the
Python API to GTK+3 is somewhat different to the D one. (And then there
is gtkmm.)

The D source binding creation appears not to deal with the comments
(which would be very hard I suspect) so they retain their original C-
ness. This can be very irritating, and indeed annoying. However, at
least there is:

http://api.gtkd.org/src/gtk/AboutDialog.html

Do not be confused by the URL or the start point, it is actually the
full API, just with a weird UX. Mayhap some of us should club together
and make this better. 

The demos in:

https://github.com/gtkd-developers/GtkD/tree/master/demos

are OK for initial learning, but seemingly rapidly run out of
usefulness. Which leads to my feeling that there are far too few
examples of GtkD use out there that are:

a. Idiomatic.
b. Up to date.
c. Reviewed and recognized as good.

As Gerald points out he has a couple of applications that are useful
for various approaches and techniques.

https://github.com/gnunn1/vgrep
https://github.com/gnunn1/terminix

> Any help on where I can get better leaning materials(GtkD)? Repo, 
> blogs post, etc please

There is my own adventure into using GtkD, especially the GStreamer
binding, I have no idea if this is good code, and it may soon have to
stop being FOSS (and so will stagnate).

https://github.com/russel/Foscam_Client

What we need here is a collection of people reviewing each others GtkD
code and having a listing board somewhere on the GtkD site of all the
codes available and what they show. It is the annotations as much as
the code itself that is needed for learning.

Without comparative review, we may end up propagating bad code and bad
GTK use.

So rather than just email as here, we should be looking to create a
"living document" on the wiki – not an historical type thing but an
always up-to-date, curated document. 

-- 
Russel.=Dr
 Russel Winder  t: +44 20 7585 2200   voip: sip:russel.winder@ekiga.net41 
Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@winder.org.ukLondon SW11 
1EN, UK   w: www.russel.org.uk  skype: russel_winder


signature.asc
Description: This is a digitally signed message part


Re: std.stdio.File.seek error

2016-03-14 Thread Nicholas Wilson via Digitalmars-d-learn

On Monday, 14 March 2016 at 05:24:48 UTC, stunaep wrote:

On Monday, 14 March 2016 at 03:07:05 UTC, Nicholas Wilson wrote:

[...]


I'm currently on windows 7. The code you gave me prints 022. 
It's weird because it always tries to convert longs to ints and 
I think that is weird because the function uses a c_long.

[...]


It wont even compile if I try giving it a long

[...]


I also tried giving it a c_long, but this line

[...]

gives this error for some reason...

[...]


It's like c_longs are not longs at all...


c_long maps to the target long which evidently is not 64-bit on 
win7

meaning you can't seek longer than int.max.
 if you cant't find _fseeki64 try looking in the windows section.
Glad you got it working on arch.

Nic


Re: std.stdio.File.seek error

2016-03-14 Thread stunaep via Digitalmars-d-learn
Just tested it on arch linux 64 bit and it works with no problem 
seeking to positions over 2^31-1