digitalmars.D.learn - Using rdmd to create shared object files
- "Malte =?UTF-8?B?S2llw59saW5nIg==?= <malte.kiessling mkalte.me> (28/28) Aug 02 2015 Hello,
- cym13 (11/40) Aug 05 2015 I'm not quite sure why you're trying to use rdmd to build shared
Hello, I am trying to use rdmd to create shared object files. The command that I am using is "rdmd --build-only -shared -fPIC -defaultlib= foo.d" This creates a file called "foo" - wich is not exactly what I expectd. However "dmd -shared -fPIC -defaultlib= foo.d " creates a file called "foo.so" - that is what i expect and need. The command ill be actually using will be similar to this: "find ../script -name *.d -exec dmd -I../../deps/ -I../../source/ -fPIC -shared -debug -g -defaultlib= {} \;" The amount of files that will be compiled by this are really likely going to increase over time, so using rdmd here would be nice in terms of compile time. The issues i have is that rdmd dosnt create .so files but (at least on my linux) creates them without a file exenstion. I could rename them with -of but that would increase this ugly find-command even more. The second thing (wich isnt such a big issue): I have to use "--build-only" for rdmd because it will try to run the newly created shared object. Also, not so on-topic to be asked here: Is there a nicer solution for the "all .d files in this directory and the ones below"? I remeber its possible to do something like "dmd ./**/*.d" but I cant get that to work... Thanks Malte
Aug 02 2015
On Sunday, 2 August 2015 at 19:04:15 UTC, Malte Kießling wrote:Hello, I am trying to use rdmd to create shared object files. The command that I am using is "rdmd --build-only -shared -fPIC -defaultlib= foo.d" This creates a file called "foo" - wich is not exactly what I expectd. However "dmd -shared -fPIC -defaultlib= foo.d " creates a file called "foo.so" - that is what i expect and need. The command ill be actually using will be similar to this: "find ../script -name *.d -exec dmd -I../../deps/ -I../../source/ -fPIC -shared -debug -g -defaultlib= {} \;" The amount of files that will be compiled by this are really likely going to increase over time, so using rdmd here would be nice in terms of compile time. The issues i have is that rdmd dosnt create .so files but (at least on my linux) creates them without a file exenstion. I could rename them with -of but that would increase this ugly find-command even more. The second thing (wich isnt such a big issue): I have to use "--build-only" for rdmd because it will try to run the newly created shared object. Also, not so on-topic to be asked here: Is there a nicer solution for the "all .d files in this directory and the ones below"? I remeber its possible to do something like "dmd ./**/*.d" but I cant get that to work... Thanks MalteI'm not quite sure why you're trying to use rdmd to build shared object files... rdmd is designed to run programs, not to build libraries. That's why it won't put a .so extension, it just (AFAIK) isn't designed for shared libraries. So why are you trying to use it instead of dmd? Besides, extensive glob (the "./**/*" thing) is shell dependant, I'm not sure it is possible on bash, it may be zsh-only. You could however do (assuming you're on an UNIX system) “ find . -name "*.d" | xargs dmd <your_options> ” where “find” finds .d files and xargs passes them as argument to dmd.
Aug 05 2015