digitalmars.D.learn - Add a precompiled c++ obj file to dub
- Fra Mecca (7/7) Oct 07 2017 Hi all,
- user1234 (5/12) Oct 07 2017 Yes, add this to your JSON:
- Fra Mecca (6/19) Oct 07 2017 I tried the sourceFiles approach, it failed and I could reproduce
- user1234 (5/26) Oct 07 2017 Huh, i'm surprised but well, if it works for you.
- b4s1L3 (7/35) Oct 09 2017 Yeah that's becuz passing *.o / *.obj files to the linker or to
- Jacob Carlborg (6/8) Oct 09 2017 Everything passed to DMD with the -L flag is passed to the linker,
Hi all, I am writing a backend that is partly Vibe.d and partly clucene in c++. I have some object files written in c++ and compiled with g++ that are not considered by dub during the linking phase and throws `function undefined error ` every time. Is there a way to tell dub to let dmd handle that .o files?
Oct 07 2017
On Saturday, 7 October 2017 at 19:56:52 UTC, Fra Mecca wrote:Hi all, I am writing a backend that is partly Vibe.d and partly clucene in c++. I have some object files written in c++ and compiled with g++ that are not considered by dub during the linking phase and throws `function undefined error ` every time. Is there a way to tell dub to let dmd handle that .o files?Yes, add this to your JSON: "sourceFiles-linux-x86_64" : [ "somepath/yourobject.o" ],
Oct 07 2017
On Saturday, 7 October 2017 at 23:54:50 UTC, user1234 wrote:On Saturday, 7 October 2017 at 19:56:52 UTC, Fra Mecca wrote:I tried the sourceFiles approach, it failed and I could reproduce that in some days. At the end I added them as linking options (lflags) but it is kinda odd that it works given that everything is supplied to dmd as -Lobj.oHi all, I am writing a backend that is partly Vibe.d and partly clucene in c++. I have some object files written in c++ and compiled with g++ that are not considered by dub during the linking phase and throws `function undefined error ` every time. Is there a way to tell dub to let dmd handle that .o files?Yes, add this to your JSON: "sourceFiles-linux-x86_64" : [ "somepath/yourobject.o" ],
Oct 07 2017
On Sunday, 8 October 2017 at 02:58:36 UTC, Fra Mecca wrote:On Saturday, 7 October 2017 at 23:54:50 UTC, user1234 wrote:Huh, i'm surprised but well, if it works for you. My advice was based on https://github.com/BBasile/dbeaengine/blob/master/dub.json (object file is passed to dmd) which works, I often use it.On Saturday, 7 October 2017 at 19:56:52 UTC, Fra Mecca wrote:I tried the sourceFiles approach, it failed and I could reproduce that in some days. At the end I added them as linking options (lflags) but it is kinda odd that it works given that everything is supplied to dmd as -Lobj.oHi all, I am writing a backend that is partly Vibe.d and partly clucene in c++. I have some object files written in c++ and compiled with g++ that are not considered by dub during the linking phase and throws `function undefined error ` every time. Is there a way to tell dub to let dmd handle that .o files?Yes, add this to your JSON: "sourceFiles-linux-x86_64" : [ "somepath/yourobject.o" ],
Oct 07 2017
On Sunday, 8 October 2017 at 04:03:27 UTC, user1234 wrote:On Sunday, 8 October 2017 at 02:58:36 UTC, Fra Mecca wrote:Yeah that's becuz passing *.o / *.obj files to the linker or to dmd is the same buisness under the hood. The problem with this DUB project is that it will only compiles with DMD. Maybe the OP used another compiler. other compilers may not support the shortcut here: https://github.com/dlang/dmd/blob/master/src/ddmd/mars.d#L626On Saturday, 7 October 2017 at 23:54:50 UTC, user1234 wrote:Huh, i'm surprised but well, if it works for you. My advice was based on https://github.com/BBasile/dbeaengine/blob/master/dub.json (object file is passed to dmd) which works, I often use it.On Saturday, 7 October 2017 at 19:56:52 UTC, Fra Mecca wrote:I tried the sourceFiles approach, it failed and I could reproduce that in some days. At the end I added them as linking options (lflags) but it is kinda odd that it works given that everything is supplied to dmd as -Lobj.oHi all, I am writing a backend that is partly Vibe.d and partly clucene in c++. I have some object files written in c++ and compiled with g++ that are not considered by dub during the linking phase and throws `function undefined error ` every time. Is there a way to tell dub to let dmd handle that .o files?Yes, add this to your JSON: "sourceFiles-linux-x86_64" : [ "somepath/yourobject.o" ],
Oct 09 2017
On 2017-10-08 04:58, Fra Mecca wrote:At the end I added them as linking options (lflags) but it is kinda odd that it works given that everything is supplied to dmd as -Lobj.oEverything passed to DMD with the -L flag is passed to the linker, basically as is. So if the linker accepts object files passed directly on the command line then it works. -- /Jacob Carlborg
Oct 09 2017