www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - phobos.lib errors/bug?

reply MM <MM_member pathlink.com> writes:
dmd 0.161 

+

private import std.c.stdlib;
private import std.stdio;
private import std.perf;

const int TILEW = 1000;
const int TILEH = 1000;

struct TILE { int x,y; int z[1]; }

void foo(TILE arr[TILEW][TILEH], int i) {
arr[i%TILEW][i%TILEH].z[0]=i;
}

void main()
{
PerformanceCounter c = new PerformanceCounter();
int i;


TILE[TILEH][TILEW] arr2;
c.start();
for(i = 0; i < 10000000; i++) foo(arr2,i);
c.stop();
writefln("foo took: ",c.milliseconds());


}

+

build.exe main.d

=

OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

C:\D\dmd\lib\phobos.lib(ti_double)  Offset 1C75EH Record Type 0091
Error 1: Previous Definition Different : __init_10TypeInfo_d
C:\D\dmd\lib\phobos.lib(ti_double)  Offset 1C778H Record Type 0091
Error 1: Previous Definition Different : __Class_10TypeInfo_d
C:\D\dmd\lib\phobos.lib(ti_double)  Offset 1C791H Record Type 0091
Error 1: Previous Definition Different : __vtbl_10TypeInfo_d

Is this a bug?
Jun 26 2006
parent Derek Parnell <derek nomail.afraid.org> writes:
On Tue, 27 Jun 2006 01:27:15 +0000 (UTC), MM wrote:
 
 Is this a bug?

Yes. Its a bug in v3.01 of Build (which BTW is not a DigitalMars product). The current version does not have this problem. Download 3.02 or use "-R:N" switch when building it. build -R:N main.d However, your code will still not run because you are trying to create a 1,000,000 element array on the stack and that will be bigger than the stack space for your app. Here is alternate code that does the same but uses the heap rather than the stack ... ================== private import std.stdio; private import std.perf; const int TILEW = 1000; const int TILEH = 1000; struct TILE { int x,y; int z[1]; } void foo(TILE[] arr, int i) { arr[(i%TILEW)*TILEH + (i%TILEH)].z[0]=i; } void main() { PerformanceCounter c = new PerformanceCounter(); int i; TILE[] arr2; // Allocate contiguous space for all the entries. arr2.length = TILEW * TILEH; c.start(); for(i = 0; i < 10000000; i++) foo(arr2,i); c.stop(); writefln("foo took: ",c.milliseconds()); } ================== -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocrity!" 27/06/2006 4:45:23 PM
Jun 26 2006