digitalmars.D.learn - Linking to a library via the linker on Windows?
- Jeremy DeHaan (6/6) Nov 19 2013 Like I said in the title, this is related to Windows. Basically,
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (4/10) Nov 19 2013 It looks like it is -L on Windows as well:
- Jeremy DeHaan (6/21) Nov 20 2013 The -L switch is just for sending switches to the linker. On OSX
- Mike Parker (11/16) Nov 20 2013 I don't believe there is anything like that. You just pass the lib name.
- Jeremy DeHaan (3/26) Nov 20 2013 Ok, thanks. I kind of figured that was the case, but I posted in
Like I said in the title, this is related to Windows. Basically, I'm looking to put a command line together to keep things consistent between Windows, OSX and Linux. On OSX and Linux I would do -L-lLibraryName, but is there something similar that one can do on Windows? Or do I have to add LibraryName.lib to the file list? Just wondering!
Nov 19 2013
On 11/19/2013 11:18 PM, Jeremy DeHaan wrote:Like I said in the title, this is related to Windows. Basically, I'm looking to put a command line together to keep things consistent between Windows, OSX and Linux. On OSX and Linux I would do -L-lLibraryName, but is there something similar that one can do on Windows? Or do I have to add LibraryName.lib to the file list? Just wondering!It looks like it is -L on Windows as well: http://dlang.org/dmd-windows.html Ali
Nov 19 2013
On Wednesday, 20 November 2013 at 07:47:39 UTC, Ali Çehreli wrote:On 11/19/2013 11:18 PM, Jeremy DeHaan wrote:The -L switch is just for sending switches to the linker. On OSX and Linux, it is -L-lLibraryName, like I mention before, where -lLibraryName is what actually gets passed to the linker. Basically I'm wondering of Optlink has a switch that does the same thing as the -l switch for linking to a library.Like I said in the title, this is related to Windows. Basically, I'm looking to put a command line together to keep things consistent between Windows, OSX and Linux. On OSX and Linux I would do -L-lLibraryName, but is there something similar that one can do on Windows? Or do I have to add LibraryName.lib to the file list? Just wondering!It looks like it is -L on Windows as well: http://dlang.org/dmd-windows.html Ali
Nov 20 2013
On 11/20/2013 5:01 PM, Jeremy DeHaan wrote:The -L switch is just for sending switches to the linker. On OSX and Linux, it is -L-lLibraryName, like I mention before, where -lLibraryName is what actually gets passed to the linker. Basically I'm wondering of Optlink has a switch that does the same thing as the -l switch for linking to a library.I don't believe there is anything like that. You just pass the lib name. dmd foo.d bar.lib You also pass a library path like so: dmd foo.d bar.lib -L+../path/to/libs This difference between Windows and other platforms creates a minor annoyance when making cross-platform build scripts for D (which, since dub came along, I don't worry about anymore). I vaguely recall a discussion around here somewhere about having DMD hide all of that behind a uniform syntax on the command line, for the library stuff at least. But it obviously didn't go anywhere.
Nov 20 2013
On Wednesday, 20 November 2013 at 12:02:36 UTC, Mike Parker wrote:On 11/20/2013 5:01 PM, Jeremy DeHaan wrote:Ok, thanks. I kind of figured that was the case, but I posted in in hopes that there was something that I had missed.The -L switch is just for sending switches to the linker. On OSX and Linux, it is -L-lLibraryName, like I mention before, where -lLibraryName is what actually gets passed to the linker. Basically I'm wondering of Optlink has a switch that does the same thing as the -l switch for linking to a library.I don't believe there is anything like that. You just pass the lib name. dmd foo.d bar.lib You also pass a library path like so: dmd foo.d bar.lib -L+../path/to/libs This difference between Windows and other platforms creates a minor annoyance when making cross-platform build scripts for D (which, since dub came along, I don't worry about anymore). I vaguely recall a discussion around here somewhere about having DMD hide all of that behind a uniform syntax on the command line, for the library stuff at least. But it obviously didn't go anywhere.
Nov 20 2013