Re: mscoff x86 invalid pointers

2015-05-10 Thread Baz via Digitalmars-d-learn

On Sunday, 10 May 2015 at 12:20:39 UTC, Etienne Cimon wrote:

On 2015-05-10 03:54, Baz wrote:

On Sunday, 10 May 2015 at 04:16:45 UTC, Etienne Cimon wrote:

On 2015-05-09 05:44, Baz wrote:

On Saturday, 9 May 2015 at 06:21:11 UTC, extrawurst wrote:

On Saturday, 9 May 2015 at 00:16:28 UTC, Etienne wrote:
I'm trying to compile a library that I think used to work 
with

-m32mscoff flag before I reset my machine configurations.

https://github.com/etcimon/memutils

Whenever I run `dub test --config=32mscoff` it gives me an 
assertion
failure, which is a global variable that already has a 
pointer value

for some reason..

I'm wondering if someone here could test this out on their 
machine
with v2.067.1? There's no reason why this shouldn't work, 
it runs
fine in DMD32/optlink  and DMD64/mscoff, just not in 
DMD32/mscoff.

Thanks!


you can always use travis-ci to do such a job for you ;)


doesn't -m32mscoff recquire phobos to be compiled as COFF 
too ? I think
that travis uses the official releases (win32 releases have 
phobos as

OMF) so he can't run the unittests like that...

The dark side of the story is that you have to recompile 
phobos by hand
with -m32mscoff...I'm not even sure that there is a option 
for this in

the win32.mak...



Meh, I ended up upgrading to 2.068 and everything went well. 
I clearly

remember 2.067.1 working but spent a whole day recompiling
druntime/phobos COFF versions in every configuration possible 
and

never got it working again


Could you tell me the way to compile druntime  phobos 32bit 
COFF ?

Would you have some custom win32.mak to share ?
Thx.



I edited win64.mak, you need to change it to MODEL=32mscoff and 
remove all occurence of amd64/ in the file (there are 3), for 
both druntime and phobos. Save this to win32mscoff.mak


You need to place the phobos32mscoff.lib into 
dmd2/windows/lib32mscoff/ (the folder doesn't exist)


Obviously there is no config for gcc-cpp...thx anyway for the 
tips.


Re: Object.factory fails for nested classes ?!

2015-05-10 Thread extrawurst via Digitalmars-d-learn

On Sunday, 10 May 2015 at 13:38:22 UTC, extrawurst wrote:
Is it a bug or just missing specification that using 
Object.factory(fullyQualifiedNameToNestedClass) fails ?


See repro here:
http://dpaste.dzfl.pl/d789237b0f46

Regards,
Stephan


Ok real nested classes (class with outer pointer) wont work 
(why does it fail inside a struct then?)
That still leaves the question why a simple class declared in a 
unittest scope wont work either (even declared as a static class):


http://dpaste.dzfl.pl/33ee48536ecb

ideas anyone ?


Re: mscoff x86 invalid pointers

2015-05-10 Thread Etienne Cimon via Digitalmars-d-learn

On 2015-05-10 03:54, Baz wrote:

On Sunday, 10 May 2015 at 04:16:45 UTC, Etienne Cimon wrote:

On 2015-05-09 05:44, Baz wrote:

On Saturday, 9 May 2015 at 06:21:11 UTC, extrawurst wrote:

On Saturday, 9 May 2015 at 00:16:28 UTC, Etienne wrote:

I'm trying to compile a library that I think used to work with
-m32mscoff flag before I reset my machine configurations.

https://github.com/etcimon/memutils

Whenever I run `dub test --config=32mscoff` it gives me an assertion
failure, which is a global variable that already has a pointer value
for some reason..

I'm wondering if someone here could test this out on their machine
with v2.067.1? There's no reason why this shouldn't work, it runs
fine in DMD32/optlink  and DMD64/mscoff, just not in DMD32/mscoff.
Thanks!


you can always use travis-ci to do such a job for you ;)


doesn't -m32mscoff recquire phobos to be compiled as COFF too ? I think
that travis uses the official releases (win32 releases have phobos as
OMF) so he can't run the unittests like that...

The dark side of the story is that you have to recompile phobos by hand
with -m32mscoff...I'm not even sure that there is a option for this in
the win32.mak...



Meh, I ended up upgrading to 2.068 and everything went well. I clearly
remember 2.067.1 working but spent a whole day recompiling
druntime/phobos COFF versions in every configuration possible and
never got it working again


Could you tell me the way to compile druntime  phobos 32bit COFF ?
Would you have some custom win32.mak to share ?
Thx.



I edited win64.mak, you need to change it to MODEL=32mscoff and remove 
all occurence of amd64/ in the file (there are 3), for both druntime and 
phobos. Save this to win32mscoff.mak


You need to place the phobos32mscoff.lib into dmd2/windows/lib32mscoff/ 
(the folder doesn't exist)


Comparing variants

2015-05-10 Thread rumbu via Digitalmars-d-learn
Comparing integer signed and unsigned variants will result in 
error:


import std.variant;

void main()
{
  auto a = 11;
  auto b = 10u; 
  assert(a  b);

  Variant va = 11;
  Variant vb = 10u;
  assert(va  vb); //error

}

std.variant.VariantException@std/variant.d(1309): Variant: 
attempting to use incompatible types int and uint


Is this intended behaviour? I'm asking because the rest of 
arithmetic/equality operations are working as expected, only 
opCmp throws.


Re: Memory usage tracking

2015-05-10 Thread tcak via Digitalmars-d-learn

On Sunday, 10 May 2015 at 09:44:42 UTC, tcak wrote:
I am testing my web server right now. I started 5 separate 
consoles and continuously sending request by using curl to it.


It uses shared memory as well, thought from `ipcs -a`, I don't 
see more than necessary amount of allocation.


At the moment, server received about 1.5M requests, and memory 
usage has reached to 128MB according to System Monitor of 
Ubuntu. (top gives a similar value as well). I saw now on `top` 
command that about 650KB shared memory is used only.


Is there any way to find out what is using that big space in 
memory? Would `-profile` do that?


Problem is that if I was to be using `-profile` flag, server 
would slow down, and I wouldn't be able to test it correctly 
already.


Hmm. Server was compiled in debug mode. Right now, it is 2.2M 
requests, and 174MB memory is in use.


Cannot find -lphobos

2015-05-10 Thread Marko Grdinic via Digitalmars-d-learn
I works just fine on Windows, but I am having difficulty figuring 
out what the trouble is on my Bodhi 1.4 Virtual Box. I've 
followed the instruction on the Codeblocks Wiki and set the 
parameters, but when I try to compile, it complains that it can't 
find Phobos.


/usr/bin/ld: cannot find -lphobos2

I've checked the search directories and the library directories 
are where it says they would be. I am not particularly familiar 
with Linux so I am not sure how to proceed from here.


Any advice?


Memory usage tracking

2015-05-10 Thread tcak via Digitalmars-d-learn
I am testing my web server right now. I started 5 separate 
consoles and continuously sending request by using curl to it.


It uses shared memory as well, thought from `ipcs -a`, I don't 
see more than necessary amount of allocation.


At the moment, server received about 1.5M requests, and memory 
usage has reached to 128MB according to System Monitor of Ubuntu. 
(top gives a similar value as well). I saw now on `top` command 
that about 650KB shared memory is used only.


Is there any way to find out what is using that big space in 
memory? Would `-profile` do that?


Problem is that if I was to be using `-profile` flag, server 
would slow down, and I wouldn't be able to test it correctly 
already.


Re: Memory usage tracking

2015-05-10 Thread weaselcat via Digitalmars-d-learn

On Sunday, 10 May 2015 at 10:43:37 UTC, tcak wrote:

On Sunday, 10 May 2015 at 09:44:42 UTC, tcak wrote:
I am testing my web server right now. I started 5 separate 
consoles and continuously sending request by using curl to 
it.


It uses shared memory as well, thought from `ipcs -a`, I don't 
see more than necessary amount of allocation.


At the moment, server received about 1.5M requests, and memory 
usage has reached to 128MB according to System Monitor of 
Ubuntu. (top gives a similar value as well). I saw now on 
`top` command that about 650KB shared memory is used only.


Is there any way to find out what is using that big space in 
memory? Would `-profile` do that?


Problem is that if I was to be using `-profile` flag, server 
would slow down, and I wouldn't be able to test it correctly 
already.


Hmm. Server was compiled in debug mode. Right now, it is 2.2M 
requests, and 174MB memory is in use.


Which compiler are you using? Also, debug mode might have linked 
against debug phobos - do a ldd on your executable.


Re: Memory usage tracking

2015-05-10 Thread tcak via Digitalmars-d-learn

On Sunday, 10 May 2015 at 10:50:40 UTC, weaselcat wrote:

On Sunday, 10 May 2015 at 10:43:37 UTC, tcak wrote:

On Sunday, 10 May 2015 at 09:44:42 UTC, tcak wrote:
I am testing my web server right now. I started 5 separate 
consoles and continuously sending request by using curl to 
it.


It uses shared memory as well, thought from `ipcs -a`, I 
don't see more than necessary amount of allocation.


At the moment, server received about 1.5M requests, and 
memory usage has reached to 128MB according to System Monitor 
of Ubuntu. (top gives a similar value as well). I saw now on 
`top` command that about 650KB shared memory is used only.


Is there any way to find out what is using that big space in 
memory? Would `-profile` do that?


Problem is that if I was to be using `-profile` flag, server 
would slow down, and I wouldn't be able to test it correctly 
already.


Hmm. Server was compiled in debug mode. Right now, it is 2.2M 
requests, and 174MB memory is in use.


Which compiler are you using? Also, debug mode might have 
linked against debug phobos - do a ldd on your executable.


I am using DMD. Web server is running as daemon, but web 
application is being debugged with gdb. For a while, gdb has 
started using 100% of CPU, and request-response slowed down 
greatly. 2.22M requests it has reached. It should end at 2.5M 
requests. Then I will check whether memory usage will go down by 
itself.


ldd result is this.

linux-vdso.so.1 =  (0x7ffc6192c000)
	libmysqlclient.so.18 = 
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.18 
(0x7ff6ecde4000)
	libpthread.so.0 = /lib/x86_64-linux-gnu/libpthread.so.0 
(0x7ff6ecbc6000)
	librt.so.1 = /lib/x86_64-linux-gnu/librt.so.1 
(0x7ff6ec9bd000)

libc.so.6 = /lib/x86_64-linux-gnu/libc.so.6 (0x7ff6ec5f8000)
/lib64/ld-linux-x86-64.so.2 (0x7ff6ed346000)
libz.so.1 = /lib/x86_64-linux-gnu/libz.so.1 (0x7ff6ec3df000)
	libdl.so.2 = /lib/x86_64-linux-gnu/libdl.so.2 
(0x7ff6ec1da000)

libm.so.6 = /lib/x86_64-linux-gnu/libm.so.6 (0x7ff6ebed4000)


I am guessing a request object is having a instance copy 
somewhere, and GC is not destroying it, but I am not sure. Would 
I be able to find out about very long alive objects?


Re: mscoff x86 invalid pointers

2015-05-10 Thread Baz via Digitalmars-d-learn

On Sunday, 10 May 2015 at 04:16:45 UTC, Etienne Cimon wrote:

On 2015-05-09 05:44, Baz wrote:

On Saturday, 9 May 2015 at 06:21:11 UTC, extrawurst wrote:

On Saturday, 9 May 2015 at 00:16:28 UTC, Etienne wrote:
I'm trying to compile a library that I think used to work 
with

-m32mscoff flag before I reset my machine configurations.

https://github.com/etcimon/memutils

Whenever I run `dub test --config=32mscoff` it gives me an 
assertion
failure, which is a global variable that already has a 
pointer value

for some reason..

I'm wondering if someone here could test this out on their 
machine
with v2.067.1? There's no reason why this shouldn't work, it 
runs
fine in DMD32/optlink  and DMD64/mscoff, just not in 
DMD32/mscoff.

Thanks!


you can always use travis-ci to do such a job for you ;)


doesn't -m32mscoff recquire phobos to be compiled as COFF too 
? I think
that travis uses the official releases (win32 releases have 
phobos as

OMF) so he can't run the unittests like that...

The dark side of the story is that you have to recompile 
phobos by hand
with -m32mscoff...I'm not even sure that there is a option for 
this in

the win32.mak...



Meh, I ended up upgrading to 2.068 and everything went well. I 
clearly remember 2.067.1 working but spent a whole day 
recompiling druntime/phobos COFF versions in every 
configuration possible and never got it working again


Could you tell me the way to compile druntime  phobos 32bit COFF 
? Would you have some custom win32.mak to share ?

Thx.



Re: Spawning a console in Windows (similar to forkpty on linux)

2015-05-10 Thread Kagamin via Digitalmars-d-learn

On Saturday, 9 May 2015 at 13:00:01 UTC, wobbles wrote:
Just as an example of running cmd through std.process, running 
this on my system:

auto pipes = pipeShell(cmd.exe);
write(pipes.stdout.readln);
write(pipes.stdout.readln);
write(pipes.stdout.readln);
return;
will print
`
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

`
and then exits.

However, adding another write line before the return; will 
cause the program to hang there, waiting for the cmd.exe 
process to flush it's next line.


I guess, the last (prompt) line is properly flushed, it just 
doesn't have EOL, that's why readln won't return it. See if 
stdout has a method to read/peek whatever data it has without 
waiting for EOL.


Re: Spawning a console in Windows (similar to forkpty on linux)

2015-05-10 Thread Kagamin via Digitalmars-d-learn

On Saturday, 9 May 2015 at 13:00:01 UTC, wobbles wrote:
My windows knowledge isnt marvelous, but I believe I'll need 
the interpreter attached.


If you only need the interpreter, pipeProcess should be fine, 
it's a normal program like anything else, just interactive.


Re: Bug or feature?

2015-05-10 Thread Ali Çehreli via Digitalmars-d-learn

On 05/10/2015 10:18 AM, Jack Applegame wrote:

code:


class A {
void test(int) {}
}

class B : A {
void test() {
super.test(1); // compiles
test(10);  // error
}
}


Error: function B.test () is not callable using argument types (int)


It is a concept called name hiding. It is intentional to prevent at 
least function hijacking.


Ali



Re: Bug or feature?

2015-05-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, May 10, 2015 10:48:33 Ali Çehreli via Digitalmars-d-learn wrote:
 On 05/10/2015 10:18 AM, Jack Applegame wrote:
  code:
 
  class A {
  void test(int) {}
  }
 
  class B : A {
  void test() {
  super.test(1); // compiles
  test(10);  // error
  }
  }
 
  Error: function B.test () is not callable using argument types (int)

 It is a concept called name hiding. It is intentional to prevent at
 least function hijacking.

Yeah. You have to alias A's overloads inside of B or explicitly declare them
as overrides and call the A versions from inside them. So, something like

alias A.test test;

or

alias test = A.test;

inside of B should work (though I haven't done it recently, so the syntax
might be slightly off), or you can just do

override void test(int i) { super.test(i); }

- Jonathan M Davis




Re: Bug or feature?

2015-05-10 Thread Manfred Nowak via Digitalmars-d-learn
Jack Applegame wrote:

 test(10);  // error
 
One can import the declaration by using an alias: 

class A {
void test(int) {}
}

class B : A {
alias test= super.test;
void test() {
super.test(1); // compiles
test(10);  // compiles
}
}

-manfred


Bug or feature?

2015-05-10 Thread Jack Applegame via Digitalmars-d-learn

code:


class A {
void test(int) {}
}

class B : A {
void test() {
super.test(1); // compiles
test(10);  // error
}
}


Error: function B.test () is not callable using argument types 
(int)


Re: Cannot find -lphobos

2015-05-10 Thread Ali Çehreli via Digitalmars-d-learn

On 05/10/2015 12:45 AM, Marko Grdinic wrote:

I works just fine on Windows, but I am having difficulty figuring out
what the trouble is on my Bodhi 1.4 Virtual Box. I've followed the
instruction on the Codeblocks Wiki and set the parameters, but when I
try to compile, it complains that it can't find Phobos.

/usr/bin/ld: cannot find -lphobos2

I've checked the search directories and the library directories are
where it says they would be. I am not particularly familiar with Linux
so I am not sure how to proceed from here.

Any advice?


dmd's -v flag may give some clues:

  $ dmd foo.d -v

dmd outputs the config file that it uses and the linker flags that it 
passes.


Ali



Re: Cannot find -lphobos

2015-05-10 Thread weaselcat via Digitalmars-d-learn

On Sunday, 10 May 2015 at 14:41:17 UTC, Ali Çehreli wrote:

On 05/10/2015 12:45 AM, Marko Grdinic wrote:
I works just fine on Windows, but I am having difficulty 
figuring out
what the trouble is on my Bodhi 1.4 Virtual Box. I've followed 
the
instruction on the Codeblocks Wiki and set the parameters, but 
when I

try to compile, it complains that it can't find Phobos.

/usr/bin/ld: cannot find -lphobos2

I've checked the search directories and the library 
directories are
where it says they would be. I am not particularly familiar 
with Linux

so I am not sure how to proceed from here.

Any advice?


dmd's -v flag may give some clues:

  $ dmd foo.d -v

dmd outputs the config file that it uses and the linker flags 
that it passes.


Ali


additionally if not using dmd it may have the libraries named 
differently.
a quick google says Bodhi linux is based on Ubuntu which doesn't 
ship dmd due to licensing issues AFAIK.


Object.factory fails for nested classes ?!

2015-05-10 Thread extrawurst via Digitalmars-d-learn
Is it a bug or just missing specification that using 
Object.factory(fullyQualifiedNameToNestedClass) fails ?


See repro here:
http://dpaste.dzfl.pl/d789237b0f46

Regards,
Stephan


Re: Cannot find -lphobos

2015-05-10 Thread Marko Grdinic via Digitalmars-d-learn
Your advice worked, thanks. It turns out that from the command 
line it compiles and links just fine.


Codeblocks is the thing that is giving me trouble. It might have 
something to do that I am using the old Codeblocks 8.0 version. I 
would like to get the newest version but the Virtual Box OS is 
outdated and the package manager won't let me get anything newer.


I downloaded the Codeblocks 13 tar manually and unpacked it, but 
Gdebi can't resolve the missing dependencies (even though they 
are right there in the directory.) It worked fine for Dmd.


Any advice for this?

On Sunday, 10 May 2015 at 15:33:24 UTC, weaselcat wrote:

On Sunday, 10 May 2015 at 14:41:17 UTC, Ali Çehreli wrote:

On 05/10/2015 12:45 AM, Marko Grdinic wrote:
I works just fine on Windows, but I am having difficulty 
figuring out
what the trouble is on my Bodhi 1.4 Virtual Box. I've 
followed the
instruction on the Codeblocks Wiki and set the parameters, 
but when I

try to compile, it complains that it can't find Phobos.

/usr/bin/ld: cannot find -lphobos2

I've checked the search directories and the library 
directories are
where it says they would be. I am not particularly familiar 
with Linux

so I am not sure how to proceed from here.

Any advice?


dmd's -v flag may give some clues:

 $ dmd foo.d -v

dmd outputs the config file that it uses and the linker flags 
that it passes.


Ali


additionally if not using dmd it may have the libraries named 
differently.
a quick google says Bodhi linux is based on Ubuntu which 
doesn't ship dmd due to licensing issues AFAIK.




Re: Bug or feature?

2015-05-10 Thread Jack Applegame via Digitalmars-d-learn

Ok, it's a feature. Thanks.