Thread overview
char buffer resize appears broken on linux 1.162
Jul 05, 2006
William S. Lear
Jul 07, 2006
Walter Bright
Jul 07, 2006
William S. Lear
Jul 07, 2006
Thomas Kuehne
July 05, 2006
% cat t.d
void main() {
char[] buffer;
buffer.length = 0;
}
% dmd -v t.d
parse     t
semantic  t
semantic2 t
semantic3 t
code      t
generating code for function 'main'
gcc t.o -o t -m32 -lphobos -lpthread -lm
t.o(.gnu.linkonce.t_Dmain+0x1f): In function `_Dmain':
: undefined reference to `_d_arraysetlength2'
collect2: ld returned 1 exit status
--- errorlevel 1

If I change char[] to int[], it works.

Bill
July 07, 2006
William S. Lear wrote:
> gcc t.o -o t -m32 -lphobos -lpthread -lm
> t.o(.gnu.linkonce.t_Dmain+0x1f): In function `_Dmain':
> : undefined reference to `_d_arraysetlength2'


_d_arraysetlength2 should be defined in the new libphobos.a. Make sure the new one is installed over the old one.
July 07, 2006
William S  Lear schrieb am 2006-07-05:
> % cat t.d
> void main() {
> char[] buffer;
> buffer.length = 0;
> }
> % dmd -v t.d
> parse     t
> semantic  t
> semantic2 t
> semantic3 t
> code      t
> generating code for function 'main'
> gcc t.o -o t -m32 -lphobos -lpthread -lm
> t.o(.gnu.linkonce.t_Dmain+0x1f): In function `_Dmain':
>: undefined reference to `_d_arraysetlength2'
> collect2: ld returned 1 exit status
> --- errorlevel 1
>
> If I change char[] to int[], it works.

I can't replicate this issue. Did you rebuild Phobos or are you trying to use GDC's GPhobos in combination with DMD?

Thomas


July 07, 2006
In article <e8kopo$1f9d$1@digitaldaemon.com>, Walter Bright says...
>
>William S. Lear wrote:
>> gcc t.o -o t -m32 -lphobos -lpthread -lm
>> t.o(.gnu.linkonce.t_Dmain+0x1f): In function `_Dmain':
>> : undefined reference to `_d_arraysetlength2'
>
>
>_d_arraysetlength2 should be defined in the new libphobos.a. Make sure the new one is installed over the old one.

Ah, I had forgotten about libphobos.a in /usr/lib.  Indeed, this was the cause.

Thank you.

Bill