www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - rdmd and extern(C)

reply spir <denis.spir gmail.com> writes:
Hello,

Is it possible use rdmd (to automagically link against imported D modules),=
 when also calling C funcs? I tried to add the C file at the end of the bui=
lding command, like eg (removed all dmd options):
	rdmd --build-only -ofmyProg myProg.d myCFuncs.o
but rdmd does not seem to transmit additional files to link against to dmd.=
 (In addition to the ones guessed from imports.)

[Also, we would be glad to get some feedback when rdmd fails: currently it =
ends silently. (At the very minimum: "Failed to compile/link." At best, som=
e more accurate messages such as "Cannot find imported module 'foo.d'.")]

Denis
-- -- -- -- -- -- --
vit esse estrany =E2=98=A3

spir.wikidot.com
Dec 22 2010
parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 12/22/10 12:13 PM, spir wrote:
 Hello,

 Is it possible use rdmd (to automagically link against imported D modules),
when also calling C funcs? I tried to add the C file at the end of the building
command, like eg (removed all dmd options):
 	rdmd --build-only -ofmyProg myProg.d myCFuncs.o
 but rdmd does not seem to transmit additional files to link against to dmd.
(In addition to the ones guessed from imports.)

 [Also, we would be glad to get some feedback when rdmd fails: currently it
ends silently. (At the very minimum: "Failed to compile/link." At best, some
more accurate messages such as "Cannot find imported module 'foo.d'.")]

 Denis
 -- -- -- -- -- -- --
 vit esse estrany ☣

 spir.wikidot.com
Looks like a good enhancement for rdmd. That it doesn't "fail successfully" is a bug. Andrei
Dec 22 2010
parent reply "Nick Sabalausky" <a a.a> writes:
"Andrei Alexandrescu" <SeeWebsiteForEmail erdani.org> wrote in message 
news:iethab$2dj9$1 digitalmars.com...
 On 12/22/10 12:13 PM, spir wrote:
 Hello,

 Is it possible use rdmd (to automagically link against imported D 
 modules), when also calling C funcs? I tried to add the C file at the end 
 of the building command, like eg (removed all dmd options):
 rdmd --build-only -ofmyProg myProg.d myCFuncs.o
 but rdmd does not seem to transmit additional files to link against to 
 dmd. (In addition to the ones guessed from imports.)

 [Also, we would be glad to get some feedback when rdmd fails: currently 
 it ends silently. (At the very minimum: "Failed to compile/link." At 
 best, some more accurate messages such as "Cannot find imported module 
 'foo.d'.")]
Looks like a good enhancement for rdmd. That it doesn't "fail successfully" is a bug.
spir: rdmd's command-line syntax is like this: rdmd {args to dmd and rdmd} app.d {args sent to app.exe} So anything after the first *.d param is automatically considered a param for when rdmd runs the app your building, not for rdmd/dmd. Of course, if you're using --build-only, then such params just simply get ignored. In short, you have to do it like this: rdmd --build-only -ofmyProg myCFuncs.o myProg.d Unfortunately, that still doesn't work with the official version of rdmd. However... Andrei: I submitted an rdmd patch for this not too long ago: http://d.puremagic.com/issues/show_bug.cgi?id=4928 It fixes this problem for object files, static library files, ".def" files and response files.
Dec 22 2010
next sibling parent reply spir <denis.spir gmail.com> writes:
On Thu, 23 Dec 2010 01:31:29 -0500
"Nick Sabalausky" <a a.a> wrote:

 Looks like a good enhancement for rdmd. That it doesn't "fail=20
 successfully" is a bug.
May I suggest that rmdm prints out the command it sends to dmd (even when s= uccessful)? Not only it's "educative" but it should provide the correct lis= t of modules ;-) (so that solving the issue about C files is then 3s work).
  spir: rdmd's command-line syntax is like this:
=20
 rdmd {args to dmd and rdmd} app.d {args sent to app.exe}
=20
 So anything after the first *.d param is automatically considered a param=
=20
 for when rdmd runs the app your building, not for rdmd/dmd. Of course, if=
=20
 you're using --build-only, then such params just simply get ignored. In=20
 short, you have to do it like this:
=20
 rdmd --build-only -ofmyProg myCFuncs.o myProg.d
Right, than you. Anyway finishing with the "program" module (the only only = one that should have a main()) makes sense. And if it's for running its arg= s come next. But the: how would rdmd makes the distinction when a prog happens to apply = on modules? (You know, refactoring tools or such). My choice would be that = they must first be 'built-only'.
 Unfortunately, that still doesn't work with the official version of rdmd.=
=20
 However...
=20
  Andrei: I submitted an rdmd patch for this not too long ago:
=20
 http://d.puremagic.com/issues/show_bug.cgi?id=3D4928
=20
 It fixes this problem for object files, static library files, ".def" file=
s=20
 and response files.
Great! Denis -- -- -- -- -- -- -- vit esse estrany =E2=98=A3 spir.wikidot.com
Dec 23 2010
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 12/23/10 5:23 AM, spir wrote:
 On Thu, 23 Dec 2010 01:31:29 -0500
 "Nick Sabalausky"<a a.a>  wrote:

 Looks like a good enhancement for rdmd. That it doesn't "fail
 successfully" is a bug.
May I suggest that rmdm prints out the command it sends to dmd (even when successful)? Not only it's "educative" but it should provide the correct list of modules ;-) (so that solving the issue about C files is then 3s work).
The --chatty option should help. Andrei
Dec 23 2010
prev sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 12/23/10 12:31 AM, Nick Sabalausky wrote:
 "Andrei Alexandrescu"<SeeWebsiteForEmail erdani.org>  wrote in message
 news:iethab$2dj9$1 digitalmars.com...
 On 12/22/10 12:13 PM, spir wrote:
 Hello,

 Is it possible use rdmd (to automagically link against imported D
 modules), when also calling C funcs? I tried to add the C file at the end
 of the building command, like eg (removed all dmd options):
 rdmd --build-only -ofmyProg myProg.d myCFuncs.o
 but rdmd does not seem to transmit additional files to link against to
 dmd. (In addition to the ones guessed from imports.)

 [Also, we would be glad to get some feedback when rdmd fails: currently
 it ends silently. (At the very minimum: "Failed to compile/link." At
 best, some more accurate messages such as "Cannot find imported module
 'foo.d'.")]
Looks like a good enhancement for rdmd. That it doesn't "fail successfully" is a bug.
spir: rdmd's command-line syntax is like this: rdmd {args to dmd and rdmd} app.d {args sent to app.exe} So anything after the first *.d param is automatically considered a param for when rdmd runs the app your building, not for rdmd/dmd. Of course, if you're using --build-only, then such params just simply get ignored. In short, you have to do it like this: rdmd --build-only -ofmyProg myCFuncs.o myProg.d Unfortunately, that still doesn't work with the official version of rdmd. However... Andrei: I submitted an rdmd patch for this not too long ago: http://d.puremagic.com/issues/show_bug.cgi?id=4928 It fixes this problem for object files, static library files, ".def" files and response files.
Thanks! Did you test on all OSs? Andrei
Dec 23 2010
parent reply "Nick Sabalausky" <a a.a> writes:
"Andrei Alexandrescu" <SeeWebsiteForEmail erdani.org> wrote in message 
news:ievlbg$elu$2 digitalmars.com...
 On 12/23/10 12:31 AM, Nick Sabalausky wrote:
 "Andrei Alexandrescu"<SeeWebsiteForEmail erdani.org>  wrote in message
 news:iethab$2dj9$1 digitalmars.com...
 On 12/22/10 12:13 PM, spir wrote:
 Hello,

 Is it possible use rdmd (to automagically link against imported D
 modules), when also calling C funcs? I tried to add the C file at the 
 end
 of the building command, like eg (removed all dmd options):
 rdmd --build-only -ofmyProg myProg.d myCFuncs.o
 but rdmd does not seem to transmit additional files to link against to
 dmd. (In addition to the ones guessed from imports.)

 [Also, we would be glad to get some feedback when rdmd fails: currently
 it ends silently. (At the very minimum: "Failed to compile/link." At
 best, some more accurate messages such as "Cannot find imported module
 'foo.d'.")]
Looks like a good enhancement for rdmd. That it doesn't "fail successfully" is a bug.
spir: rdmd's command-line syntax is like this: rdmd {args to dmd and rdmd} app.d {args sent to app.exe} So anything after the first *.d param is automatically considered a param for when rdmd runs the app your building, not for rdmd/dmd. Of course, if you're using --build-only, then such params just simply get ignored. In short, you have to do it like this: rdmd --build-only -ofmyProg myCFuncs.o myProg.d Unfortunately, that still doesn't work with the official version of rdmd. However... Andrei: I submitted an rdmd patch for this not too long ago: http://d.puremagic.com/issues/show_bug.cgi?id=4928 It fixes this problem for object files, static library files, ".def" files and response files.
Thanks! Did you test on all OSs?
All that I have access to. Which is two: WinXP and Kubuntu (both x86, 32-bit).
Dec 23 2010
parent "Nick Sabalausky" <a a.a> writes:
"Nick Sabalausky" <a a.a> wrote in message 
news:if04me$1vpa$1 digitalmars.com...
 "Andrei Alexandrescu" <SeeWebsiteForEmail erdani.org> wrote in message 
 news:ievlbg$elu$2 digitalmars.com...
 On 12/23/10 12:31 AM, Nick Sabalausky wrote:
 "Andrei Alexandrescu"<SeeWebsiteForEmail erdani.org>  wrote in message
 news:iethab$2dj9$1 digitalmars.com...
 On 12/22/10 12:13 PM, spir wrote:
 Hello,

 Is it possible use rdmd (to automagically link against imported D
 modules), when also calling C funcs? I tried to add the C file at the 
 end
 of the building command, like eg (removed all dmd options):
 rdmd --build-only -ofmyProg myProg.d myCFuncs.o
 but rdmd does not seem to transmit additional files to link against to
 dmd. (In addition to the ones guessed from imports.)

 [Also, we would be glad to get some feedback when rdmd fails: 
 currently
 it ends silently. (At the very minimum: "Failed to compile/link." At
 best, some more accurate messages such as "Cannot find imported module
 'foo.d'.")]
Looks like a good enhancement for rdmd. That it doesn't "fail successfully" is a bug.
spir: rdmd's command-line syntax is like this: rdmd {args to dmd and rdmd} app.d {args sent to app.exe} So anything after the first *.d param is automatically considered a param for when rdmd runs the app your building, not for rdmd/dmd. Of course, if you're using --build-only, then such params just simply get ignored. In short, you have to do it like this: rdmd --build-only -ofmyProg myCFuncs.o myProg.d Unfortunately, that still doesn't work with the official version of rdmd. However... Andrei: I submitted an rdmd patch for this not too long ago: http://d.puremagic.com/issues/show_bug.cgi?id=4928 It fixes this problem for object files, static library files, ".def" files and response files.
Thanks! Did you test on all OSs?
All that I have access to. Which is two: WinXP and Kubuntu (both x86, 32-bit).
I have some other rdmd patches in bugzilla too. A bugzilla search on "rdmd" will find them all.
Dec 23 2010