object.d: Error: module object is in file 'object.d' which cannot be read

2011-03-27 Thread Ishan Thilina
When I give dmd untitled.d command in my ubuntu maverick 64 bit laptop I get the following error. object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = /etc/../../src/phobos import path[1] = /etc/../../src/druntime/import I tried all morning to solve this

Re: Using D libs in C

2011-03-27 Thread Dainius (GreatEmerald)
OK, now I have a question about passing variables. In D, I have a dynamic array of strings and I want C to get that array. Yet C supports neither dynamic arrays nor strings. So is there a way to accomplish this?

Re: Using D libs in C

2011-03-27 Thread bearophile
Dainius (GreatEmerald): OK, now I have a question about passing variables. In D, I have a dynamic array of strings and I want C to get that array. Yet C supports neither dynamic arrays nor strings. So is there a way to accomplish this? To use a D data structure from C you need first of all

Re: Using D libs in C

2011-03-27 Thread Dainius (GreatEmerald)
Well, the situation is like this: D creates a list of names of files that should be loaded by C. C then takes the list, uses it to load the files, then stores both the pointers to the loaded files and the names of the files in an array of structs. Then when C wants to access the files, it asks D

Re: object.d: Error: module object is in file 'object.d' which cannot be read

2011-03-27 Thread Trass3r
object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = /etc/../../src/phobos import path[1] = /etc/../../src/druntime/import As you can see dmd.conf uses relative paths. That guide needs an overhaul. The easiest way is to copy the contents of the zip archive

Re: object.d: Error: module object is in file 'object.d' which cannot be read

2011-03-27 Thread spir
On 03/27/2011 12:28 PM, Ishan Thilina wrote: When I give dmd untitled.d command in my ubuntu maverick 64 bit laptop I get the following error. object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = /etc/../../src/phobos import path[1] =

Re: object.d: Error: module object is in file 'object.d' which cannot be read

2011-03-27 Thread spir
On 03/27/2011 12:28 PM, Ishan Thilina wrote: When I give dmd untitled.d command in my ubuntu maverick 64 bit laptop I get the following error. object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = /etc/../../src/phobos import path[1] =

null Vs [] return arrays

2011-03-27 Thread bearophile
I have compiled this little D2 program: int[] foo() { return []; } int[] bar() { return null; } void main() {} Using DMD 2.052, dmd -O -release -inline test2.d This is the asm of the two functions: _D5test23fooFZAicomdat L0: pushEAX mov EAX,offset

Module Searching Roots

2011-03-27 Thread Caligo
I'm in directory ~/root and I have 't1.d' in ~/root/src/core directory, and nothing else. I run: 'gdc -O3 -o t1 t1.d -B./src/core' but I get gdc: t1.d: No such file or directory gdc: no input files I've tried different paths, but I can't get it work. What's the problem?

Re: Using D libs in C

2011-03-27 Thread bearophile
Dainius (GreatEmerald): Well, the situation is like this: D creates a list of names of files that should be loaded by C. C then takes the list, uses it to load the files, then stores both the pointers to the loaded files and the names of the files in an array of structs. Then when C wants to

Sample source code for D

2011-03-27 Thread Ishan Thilina
I am a novice to D. Is there any place that I can get sample source codes for D ? Thanks...!

Re: Using D libs in C

2011-03-27 Thread Dainius (GreatEmerald)
Hmm, if I was to do it from C, I would have to deal with all the allocation, since I don't know how large the array is going to be when it's complete, while D doesn't need to know since it uses dynamic arrays.

Re: null Vs [] return arrays

2011-03-27 Thread Kagamin
bearophile Wrote: I have compiled this little D2 program: int[] foo() { return []; } int[] bar() { return null; } void main() {} Using DMD 2.052, dmd -O -release -inline test2.d This is the asm of the two functions: _D5test23fooFZAicomdat L0: pushEAX

Re: Sample source code for D

2011-03-27 Thread Kagamin
Ishan Thilina Wrote: I am a novice to D. Is there any place that I can get sample source codes for D ? Thanks...! There're examples in docs for phobos and other libraries.

Re: Sample source code for D

2011-03-27 Thread Ishan Thilina
Yeah, I saw them. Aren't there any other places? :)

Re: Sample source code for D

2011-03-27 Thread David Nadlinger
On 3/27/11 6:59 PM, Ishan Thilina wrote: I am a novice to D. Is there any place that I can get sample source codes for D ? Thanks...! Are you looking for example code explaining specific pieces of functionality (e.g. Phobos), or just for applications/libraries written in D so you can see

Re: Sample source code for D

2011-03-27 Thread Lutger Blijdestijn
Ishan Thilina wrote: I am a novice to D. Is there any place that I can get sample source codes for D ? Thanks...! examples from TDPL: http://erdani.com/tdpl/code/ You could browse github and dsource. Some blogposts also contain examples, see http://planet.dsource.org/

Re: null Vs [] return arrays

2011-03-27 Thread bearophile
Kagamin: [] is not null, it's an array of 0 elements, what is done exactly. edx points to the allocated array. I don't understand what you say. I think the caller of foo() and bar() receive the same thing, two empty registers. I think that cast(int[])null and cast(int[])[] are the same thing

Re: object.d: Error: module object is in file 'object.d' which cannot be read

2011-03-27 Thread Jacob Carlborg
On 2011-03-27 14:55, spir wrote: On 03/27/2011 12:28 PM, Ishan Thilina wrote: When I give dmd untitled.d command in my ubuntu maverick 64 bit laptop I get the following error. object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = /etc/../../src/phobos

Re: object.d: Error: module object is in file 'object.d' which cannot be read

2011-03-27 Thread Trass3r
object.d: Error: module object is in file 'object.d' which cannot be read Specify path to file 'object.d' with -I switch Could it be you also deleted the dmd.conf in the local dmd/linux/bin?

Re: object.d: Error: module object is in file 'object.d' which cannot be read

2011-03-27 Thread Jacob Carlborg
On 2011-03-27 12:28, Ishan Thilina wrote: When I give dmd untitled.d command in my ubuntu maverick 64 bit laptop I get the following error. object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = /etc/../../src/phobos import path[1] =

Re: object.d: Error: module object is in file 'object.d' which cannot be read

2011-03-27 Thread Ishan Thilina
@Jacob: An error comes when the ./dvm install dvm command is given. ./dvm: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory @Trass3r: No, dmd.conf in the dmd2/linux/bin is there safely

Re: object.d: Error: module object is in file 'object.d' which cannot be read

2011-03-27 Thread Jonathan M Davis
On 2011-03-27 12:24, Ishan Thilina wrote: No, dmd.conf in the dmd2/linux/bin is there safely Perhaps druntime got messed up then. Is dmd2/src/druntime/import/object.di there? Or did you ever mess with your dmd.conf? If you're using the default and you've left files in place without trying to

Re: object.d: Error: module object is in file 'object.d' which cannot be read

2011-03-27 Thread Jacob Carlborg
On 2011-03-27 21:24, Ishan Thilina wrote: @Jacob: An error comes when the ./dvm install dvm command is given. ./dvm: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory You don't have libz installed? Oh, you're running 64bit, you need

Re: object.d: Error: module object is in file 'object.d' which cannot be read

2011-03-27 Thread Jonathan M Davis
On 2011-03-27 13:20, Jacob Carlborg wrote: On 2011-03-27 21:24, Ishan Thilina wrote: @Jacob: An error comes when the ./dvm install dvm command is given. ./dvm: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory You don't

Re: null Vs [] return arrays

2011-03-27 Thread Jonathan M Davis
On 2011-03-27 11:42, bearophile wrote: Kagamin: [] is not null, it's an array of 0 elements, what is done exactly. edx points to the allocated array. I don't understand what you say. I think the caller of foo() and bar() receive the same thing, two empty registers. I think that

Re: Assertion failure: '!vthis-csym' on line 703 in file 'glue.c'

2011-03-27 Thread nrgyzer
== Auszug aus David Nadlinger (s...@klickverbot.at)'s Artikel On 3/26/11 11:08 PM, bearophile wrote: I suggest to copy your code, and then keep removing lines from your copy, making sure it keep showing the same compiler error. In some time you will probably be able to produce a small program,

Re: Assertion failure: '!vthis-csym' on line 703 in file 'glue.c'

2011-03-27 Thread bearophile
nrgyzer: In my tests, that code above doesn't produces the assertion failure, but my original source code looks very similar. You may have to start over then. I suggest to duplicate the whole code, and then start on the copied version removing modules and lines of code, compiling it every

Re: null Vs [] return arrays

2011-03-27 Thread bearophile
Jonathan M Davis: the compiler can likely make assumptions about null that it can't make about [], since it probably treats [] more generally without worrying about the fact that it happens to be empty as far as optimizations go - that and there _is_ a semantic difference between null

Re: Assertion failure: '!vthis-csym' on line 703 in file 'glue.c'

2011-03-27 Thread nrgyzer
== Auszug aus bearophile (bearophileh...@lycos.com)'s Artikel nrgyzer: In my tests, that code above doesn't produces the assertion failure, but my original source code looks very similar. You may have to start over then. I suggest to duplicate the whole code, and then start on the copied

Techniques on debugging runtime errors?

2011-03-27 Thread Andrej Mitrovic
I have this sort of runtime error in a fairly involved project: --- main.exe - Application Error --- The instruction at 0x0411b00e referenced memory at 0x0020. The memory could not be read. --- Background info: Its a

Re: Techniques on debugging runtime errors?

2011-03-27 Thread Andrej Mitrovic
Actually it looks like I can recreate this bug in non-realtime mode as well. I forgot that I can actually process audio at whatever timing I want to (I haven't touched this project in a while..). Oddly enough I can call various DLL functions but it fails the second I try to pass some audio data to

Re: Techniques on debugging runtime errors?

2011-03-27 Thread Daniel Green
On 3/27/2011 7:58 PM, Andrej Mitrovic wrote: Actually it looks like I can recreate this bug in non-realtime mode as well. I forgot that I can actually process audio at whatever timing I want to (I haven't touched this project in a while..). Oddly enough I can call various DLL functions but it

Re: Techniques on debugging runtime errors?

2011-03-27 Thread Andrej Mitrovic
I've found the problem and the solution, see this post: http://www.kvraudio.com/forum/viewtopic.php?p=4467686#4467686 I completely forgot that the VST standard has at least two different implementations, v2.3 and v2.4. And I've also forgot that I need to ask the DLL if it supports calling one of

std.conv.to can't convert to bool?

2011-03-27 Thread Andrej Mitrovic
import std.stdio; import std.conv : to; void main() { uint state = 1; writeln( to!bool(state) ); } D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\conv.d(99): Error: template std.conv.toImpl(T,S) if (!implicitlyConverts!(S,T) isSomeString!(T) isInputRange!(Unqual!(S))

Re: std.conv.to can't convert to bool?

2011-03-27 Thread Andrej Mitrovic
Wow not a minute later and I get bitten by my own solution. A C function returned 1 for a supported feature, and -1 otherwise. And of course -1 got converted to true, so then I had a bug in my code. Damn silly C functions which return -1 when they should return 0. Or damn me for not RTFM'ing.

Re: Sample source code for D

2011-03-27 Thread Ishan Thilina
@ David: I'm looking for example code that explains specific pieces of functionality :) @Lutger: Those two links were really helpful :). Thank you :)