digitalmars.D.learn - noob string concatenation help.
- anupam kapoor (26/26) Apr 13 2007 hi all,
- Frits van Bommel (5/16) Apr 13 2007 It looks like you're trying to use a new DMD with an old Phobos. You
- anupam kapoor (5/8) Apr 13 2007 strange...probably copied the wrong version of file over. is it possible...
- Frits van Bommel (8/14) Apr 13 2007 The DMD version can be determined by simply typing 'dmd' at the command
- anupam kapoor (7/15) Apr 13 2007 true.
- Frits van Bommel (8/11) Apr 13 2007 You can probably use "close" Phobos versions most of the time, but
- Jarrett Billingsley (4/7) Apr 13 2007 It might have been the array resize and append improvements in 1.010 as
- Frits van Bommel (10/18) Apr 14 2007 No, I'm actually pretty sure the variants ending in 'T' were introduced
- Georg Wrede (15/26) May 09 2007 I'd say one should *never* use anything but the compiler's own libphobos...
- anupam kapoor (11/16) Apr 13 2007 replying to self.
hi all, i am trying out a trivial string concatenation sample like this : ,---- | void do_string_test() | { | char[] s; | writefln("Length: %d\tString: '%s'", s.length, s); | | s ~= "something "; | writefln("Length: %d\tString: '%s'", s.length, s); | | s ~= "whatever"; | writefln("Length: %d\tString: '%s'", s.length, s); | } `---- however, i get the following link errors: gcc string.o -o obj/string-test -m32 -lphobos -lpthread -lm string.o: In function `_Dmain': string.d:(.gnu.linkonce.t_Dmain+0x45): undefined reference to `_d_arrayappendT' string.d:(.gnu.linkonce.t_Dmain+0x78): undefined reference to `_d_arrayappendT' collect2: ld returned 1 exit status --- errorlevel 1 can you please help ? is my installation br0ken ? i have used stuff from the wiki4d for setting up the environment. thank you anupam
Apr 13 2007
anupam kapoor wrote: [snip]however, i get the following link errors: gcc string.o -o obj/string-test -m32 -lphobos -lpthread -lm string.o: In function `_Dmain': string.d:(.gnu.linkonce.t_Dmain+0x45): undefined reference to `_d_arrayappendT' string.d:(.gnu.linkonce.t_Dmain+0x78): undefined reference to `_d_arrayappendT' collect2: ld returned 1 exit status --- errorlevel 1 can you please help ? is my installation br0ken ? i have used stuff from the wiki4d for setting up the environment.It looks like you're trying to use a new DMD with an old Phobos. You should check your import paths for a leftover libphobos.a from a previous installation.
Apr 13 2007
Frits van Bommel Wrote:It looks like you're trying to use a new DMD with an old Phobos. You should check your import paths for a leftover libphobos.a from a previous installation.strange...probably copied the wrong version of file over. is it possible to find out the version of compiler (front-end) that i am currently using, something similar to "gcc --version" thinge ? thank you anupam
Apr 13 2007
anupam kapoor wrote:Frits van Bommel Wrote:The DMD version can be determined by simply typing 'dmd' at the command line. It's on the first line, so (on Linux) 'dmd | head -n 1' will remove all the extra stuff. Also interesting would be the version of Phobos it's finding (since that seems to be older than your DMD). I'm not sure if there's a good way to determine this other than manually checking the import paths DMD searches for libphobos.a, and comparing the date to DMD release dates...It looks like you're trying to use a new DMD with an old Phobos. You should check your import paths for a leftover libphobos.a from a previous installation.strange...probably copied the wrong version of file over. is it possible to find out the version of compiler (front-end) that i am currently using, something similar to "gcc --version" thinge ?
Apr 13 2007
Frits van Bommel Wrote:The DMD version can be determined by simply typing 'dmd' at the command line. It's on the first line, so (on Linux) 'dmd | head -n 1' will remove all the extra stuff.thanks !Also interesting would be the version of Phobos it's finding (since that seems to be older than your DMD). I'm not sure if there's a good way to determine this other than manually checking the import paths DMD searches for libphobos.a, and comparing the date to DMD release dates...true. is there a strict one-to-one relationship between libphobos and D releases i.e. libphobos-ver-X goes _only_ with d-version-X ? it does feel a bit odd to have that kind of restriction though. anupam
Apr 13 2007
anupam kapoor wrote:is there a strict one-to-one relationship between libphobos and D releases i.e. libphobos-ver-X goes _only_ with d-version-X ? it does feel a bit odd to have that kind of restriction though.You can probably use "close" Phobos versions most of the time, but sometimes incompatibilities are introduced. For this reason it's typically best to just use the Phobos version corresponding to your DMD version, unless you have a good reason not to. The particular incompatibility causing your problem was IIRC introduced when the improved GC got implemented just after v1.00 and memory allocation started needing the TypeInfo for the allocated memory.
Apr 13 2007
"Frits van Bommel" <fvbommel REMwOVExCAPSs.nl> wrote in message news:evoor3$1n4g$1 digitalmars.com...The particular incompatibility causing your problem was IIRC introduced when the improved GC got implemented just after v1.00 and memory allocation started needing the TypeInfo for the allocated memory.It might have been the array resize and append improvements in 1.010 as well.
Apr 13 2007
Jarrett Billingsley wrote:"Frits van Bommel" <fvbommel REMwOVExCAPSs.nl> wrote in message news:evoor3$1n4g$1 digitalmars.com...No, I'm actually pretty sure the variants ending in 'T' were introduced at the time of the new GC. The postfix 'T' seems to indicate it needs TypeInfo. Because those functions are extern(C) they aren't mangled, so if the argument lists need to change they are renamed to reflect that. (The most likely reason they're extern(C) is probably _because_ it disables mangling, removing the need to hard-code their module names into the compiler) P.S. Also, _d_arrayappendT happens to be in phobos/internal/gc/gc.d in an unzipped v1.009 tree I happened to have handy :).The particular incompatibility causing your problem was IIRC introduced when the improved GC got implemented just after v1.00 and memory allocation started needing the TypeInfo for the allocated memory.It might have been the array resize and append improvements in 1.010 as well.
Apr 14 2007
Frits van Bommel wrote:anupam kapoor wrote:I'd say one should *never* use anything but the compiler's own libphobos version. (While some gurus might get away with it, some of the time, I can see no reason even for them to do it. It's simply asking for trouble.) Especially when one is learning the language (whether a noob or a 20-year C++ guru), the wrong version would be simply another place causing unexpected behavior. And even worse if it "seems to work" in the beginning. Then one forgets about having a wrong version, and people trying to help here probably can't always guess it's a version problem. Even if they could, it'd waste everybody's time. Certainly, Walter has never promised to even think about anybody using "a wrong libphobos version". This means that subtle changes can and will be introduced whenever needed, and most of the time they aren't explained in the changelog. Only some of the bigger things are.is there a strict one-to-one relationship between libphobos and D releases i.e. libphobos-ver-X goes _only_ with d-version-X ? it does feel a bit odd to have that kind of restriction though.You can probably use "close" Phobos versions most of the time, but sometimes incompatibilities are introduced. For this reason it's typically best to just use the Phobos version corresponding to your DMD version, unless you have a good reason not to.
May 09 2007
gcc string.o -o obj/string-test -m32 -lphobos -lpthread -lm string.o: In function `_Dmain': string.d:(.gnu.linkonce.t_Dmain+0x45): undefined reference to `_d_arrayappendT' string.d:(.gnu.linkonce.t_Dmain+0x78): undefined reference to `_d_arrayappendT' collect2: ld returned 1 exit statusreplying to self. the undefined symbol is present in libphobos.a, somehow dmd cannot find it. if i try a "manual" link via gcc using: "gcc string.o -o obj/st -m32 -L/usr/local/lib -lphobos -lpthread -lm" it just works. here is how my /etc/dmd.conf looks: ,---- | [Environment] | DFLAGS="-I/usr/local/lib/phobos -L-L/usr/local/lib" `---- the phobos sources are in /usr/local/lib/phobos while, libphobos.a is in /usr/local/lib. anupam
Apr 13 2007