Thread overview
having trouble linking a library into a DLL
Aug 19, 2010
Cody Rose
Aug 20, 2010
Stanislav Blinov
Aug 20, 2010
Cody Rose
August 19, 2010
I'm trying to create a Windows DLL as described in the tutorial at http://www.digitalmars.com/d/2.0/dll.html. I got the basic example working fine, but if I try to get more complicated, it doesn't work. Specifically, I'm trying to link another static library into my DLL (the project is called canto):

dmd -ofcanto.dll -L/IMPLIB canto.d dllmain.d canto.def IddParserD.lib

Based on the example given, this seems like it should work, but when I run it, neither the .dll nor its implementation lib is created (even though DMD reports no errors). A canto.obj was generated and I tried to use optlink directly, but again no .dll was created.

Additionally, if I leave the .lib off the DMD command line, DMD reports link
errors (as it should) but then somehow builds a .dll and ATA.lib anyway (I
don't know why it's not naming the implementation library correctly).
(Naturally, these are not useful for anything.)

How am I supposed to do what I'm trying to do?
August 20, 2010
 20.08.2010 1:04, Cody Rose wrote:

try using -L/IMPLIB:canto.lib

> I'm trying to create a Windows DLL as described in the tutorial at
> http://www.digitalmars.com/d/2.0/dll.html. I got the basic example working
> fine, but if I try to get more complicated, it doesn't work. Specifically, I'm
> trying to link another static library into my DLL (the project is called canto):
>
> dmd -ofcanto.dll -L/IMPLIB canto.d dllmain.d canto.def IddParserD.lib
>
> Based on the example given, this seems like it should work, but when I run it,
> neither the .dll nor its implementation lib is created (even though DMD
> reports no errors). A canto.obj was generated and I tried to use optlink
> directly, but again no .dll was created.
>
> Additionally, if I leave the .lib off the DMD command line, DMD reports link
> errors (as it should) but then somehow builds a .dll and ATA.lib anyway (I
> don't know why it's not naming the implementation library correctly).
> (Naturally, these are not useful for anything.)
>
> How am I supposed to do what I'm trying to do?
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Filtered-With-Copfilter: Version 0.84beta4 (ProxSMTP 1.8)
> Copfilter-Filtered-With: SpamAssassin 3.2.5
> Copfilter-Virus-Scanned: ClamAV 0.94.2
> by Markus Madlener @ http://www.copfilter.org
>

August 20, 2010
It doesn't change anything (other than now correctly naming the useless ATA.lib
canto.lib).

== Quote from Stanislav Blinov (blinov@loniir.ru)'s article
>   20.08.2010 1:04, Cody Rose wrote:

> try using -L/IMPLIB:canto.lib

> > I'm trying to create a Windows DLL as described in the tutorial at http://www.digitalmars.com/d/2.0/dll.html. I got the basic example working fine, but if I try to get more complicated, it doesn't work. Specifically, I'm trying to link another static library into my DLL (the project is called canto):
> >
> > dmd -ofcanto.dll -L/IMPLIB canto.d dllmain.d canto.def IddParserD.lib
> >
> > Based on the example given, this seems like it should work, but when I run it, neither the .dll nor its implementation lib is created (even though DMD reports no errors). A canto.obj was generated and I tried to use optlink directly, but again no .dll was created.
> >
> > Additionally, if I leave the .lib off the DMD command line, DMD reports link
> > errors (as it should) but then somehow builds a .dll and ATA.lib anyway (I
> > don't know why it's not naming the implementation library correctly).
> > (Naturally, these are not useful for anything.)
> >
> > How am I supposed to do what I'm trying to do?
> >
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> > Filtered-With-Copfilter: Version 0.84beta4 (ProxSMTP 1.8)
> > Copfilter-Filtered-With: SpamAssassin 3.2.5
> > Copfilter-Virus-Scanned: ClamAV 0.94.2
> > by Markus Madlener @ http://www.copfilter.org
> >