digitalmars.D - [DMD Request] dmd -l switch for libraries
- Nick (15/15) Feb 23 2005 It's currently a bit awkward to use D libraries with dmd on linux. Say I...
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (4/6) Feb 23 2005 Not as a clumsy as "-L-L/home/yourname/dmd/lib"... :-)
- Alex Stevenson (16/22) Feb 23 2005 Ah... So that's how you do it... Used dmd for a crypto practical at uni ...
- =?ISO-8859-15?Q?Anders_F_Bj=F6rklund?= (4/13) Feb 23 2005 I wrote it up at:
-
Alex Stevenson
(4/4)
Feb 23 2005
On Wed, 23 Feb 2005 19:07:19 +0100, Anders F Björklund
... - =?ISO-8859-15?Q?Anders_F_Bj=F6rklund?= (4/6) Feb 23 2005 I just wrote it the other day... Maybe one day it'll find its way
- Nick (10/13) Feb 23 2005 Just as a suggestion of how to set it up: I made a shell script called '...
It's currently a bit awkward to use D libraries with dmd on linux. Say I have a library called libmylib.a which is made with D. To compile the program 'myprog' you would expect that dmd -L-lmylib myprog.d would work, but it doesn't. It produces gcc myprog.o -o myprog -lphobos -lpthread -lm -Xlinker -lmylib but since parameter order matters when linking with gcc, this won't link since mylib depends on phobos. The correct place for the '-lmylib' parameter would be between '-o myprog' and '-lphobos'. So, Walter, can you please oh please make a -l switch which puts the library parameter to gcc in the correct place? :) (I know a workaround is to write dmd myprog -L-lmylib -L-lphobos, but in some cases you would have to add pthread and m as well. And besides, "-L-l" looks a bit clumsy, doesn't it?) Nick
Feb 23 2005
Nick wrote:(I know a workaround is to write dmd myprog -L-lmylib -L-lphobos,you should also be able to use: dmd myprog.d libmylib.a ?And besides, "-L-l" looks a bit clumsy, doesn't it?)Not as a clumsy as "-L-L/home/yourname/dmd/lib"... :-) --anders
Feb 23 2005
On Wed, 23 Feb 2005 14:29:54 +0100, Anders F Björklund <afb algonet.se> wrote:Nick wrote:Ah... So that's how you do it... Used dmd for a crypto practical at uni today but couldn't get dmd to pass phobos location to the linker... Never would have guessed -L-L~/dmd/lib btw - the linux installation page (http://www.digitalmars.com/d/dcompiler.html) tells me to copy libphobos.a to /usr/lib and dmd.conf to /etc - I certainly don't have write access to these at uni, so would it be worth mentioning alternatives? As it was I ended up compiling with -c and adding a manual link step into my Makefile. btw: D was a complete success for my practical - implemented Linear Feedback Shift Register class much faster than those struggling with C++ and with less code -- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/(I know a workaround is to write dmd myprog -L-lmylib -L-lphobos,you should also be able to use: dmd myprog.d libmylib.a ?And besides, "-L-l" looks a bit clumsy, doesn't it?)Not as a clumsy as "-L-L/home/yourname/dmd/lib"... :-) --anders
Feb 23 2005
Alex Stevenson wrote:Ah... So that's how you do it... Used dmd for a crypto practical at uni today but couldn't get dmd to pass phobos location to the linker... Never would have guessed -L-L~/dmd/lib btw - the linux installation page (http://www.digitalmars.com/d/dcompiler.html) tells me to copy libphobos.a to /usr/lib and dmd.conf to /etc - I certainly don't have write access to these at uni, so would it be worth mentioning alternatives?I wrote it up at: http://www.prowiki.org/wiki4d/wiki.cgi?D__Tutorial/InstallingDCompiler --anders
Feb 23 2005
On Wed, 23 Feb 2005 19:07:19 +0100, Anders F Björklund <afb algonet.se> wrote: Ah, cheers. Maybe one day I'll learn to check the 'usual' sources of information before doing a random hack of my own...
Feb 23 2005
Alex Stevenson wrote:Ah, cheers. Maybe one day I'll learn to check the 'usual' sources of information before doing a random hack of my own...I just wrote it the other day... Maybe one day it'll find its way onto the offical webpages as well as the user-contributed Wiki4D ? --anders
Feb 23 2005
In article <opsmnwezzb08qma6 mjolnir.spamnet.local>, Alex Stevenson says...Ah... So that's how you do it... Used dmd for a crypto practical at uni today but couldn't get dmd to pass phobos location to the linker... Never would have guessed -L-L~/dmd/libJust as a suggestion of how to set it up: I made a shell script called 'dmd' in my own bin/ directory, which basically contains [set environment variables here] $DMD_PATH/bin/dmd -I$DMD_PATH/src/phobos -I$MYINC_PATH -L-L$LIB_PATH $* and this works great for me. Oh and I prefer to make a symlink to libphobos.a, so I don't have to remember to copy it every time I update dmd. Nick
Feb 23 2005