www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Linking with .dylibs on OSX?

reply "Jeremy DeHaan" <dehaan.jeremiah gmail.com> writes:
I was just curious if DMD supported linking with .dylib files on 
OSX.

Would one simply do something like this?

"dmd main.d somelib.dylib"

Thanks!
Jul 19 2013
parent reply "evilrat" <evilrat666 gmail.com> writes:
On Friday, 19 July 2013 at 18:19:20 UTC, Jeremy DeHaan wrote:
 I was just curious if DMD supported linking with .dylib files 
 on OSX.

 Would one simply do something like this?

 "dmd main.d somelib.dylib"

 Thanks!
i don't remember exactly, but if this not work for you try something like this dmd main.d -L-L/path/to/lib.dylib i think there was a topic on this on wiki
Jul 19 2013
parent reply "Jeremy DeHaan" <dehaan.jeremiah gmail.com> writes:
On Friday, 19 July 2013 at 18:29:12 UTC, evilrat wrote:
 On Friday, 19 July 2013 at 18:19:20 UTC, Jeremy DeHaan wrote:
 I was just curious if DMD supported linking with .dylib files 
 on OSX.

 Would one simply do something like this?

 "dmd main.d somelib.dylib"

 Thanks!
i don't remember exactly, but if this not work for you try something like this dmd main.d -L-L/path/to/lib.dylib i think there was a topic on this on wiki
That worked! Just one too many -L's though. It ended up being dmd main.d -L/path/to/lib.dylib
Jul 19 2013
parent reply "Jeremy DeHaan" <dehaan.jeremiah gmail.com> writes:
On Friday, 19 July 2013 at 19:52:49 UTC, Jeremy DeHaan wrote:
 On Friday, 19 July 2013 at 18:29:12 UTC, evilrat wrote:
 On Friday, 19 July 2013 at 18:19:20 UTC, Jeremy DeHaan wrote:
 I was just curious if DMD supported linking with .dylib files 
 on OSX.

 Would one simply do something like this?

 "dmd main.d somelib.dylib"

 Thanks!
i don't remember exactly, but if this not work for you try something like this dmd main.d -L-L/path/to/lib.dylib i think there was a topic on this on wiki
That worked! Just one too many -L's though. It ended up being dmd main.d -L/path/to/lib.dylib
I have another question. Is there a way to specify a search directory and then link to each dylib? I have someone that I'm trying to help by the way, and I don't have a Mac :P I was pretty sure that -L-L/path/ seemed to be the way to add the search directory, but if I have a dylib named libsomelib.dylib, would I pass -Lsomelib, -Llibsomelib.dylib, -Lsomelib.dylib, or something else? Thanks for you help. P.S. Only a guide for compiling and linking on Windows is in the wiki. That should definitely be changed.
Jul 19 2013
parent reply "evilrat" <evilrat666 gmail.com> writes:
On Friday, 19 July 2013 at 22:30:42 UTC, Jeremy DeHaan wrote:
 On Friday, 19 July 2013 at 19:52:49 UTC, Jeremy DeHaan wrote:
 On Friday, 19 July 2013 at 18:29:12 UTC, evilrat wrote:
 On Friday, 19 July 2013 at 18:19:20 UTC, Jeremy DeHaan wrote:
 I was just curious if DMD supported linking with .dylib 
 files on OSX.

 Would one simply do something like this?

 "dmd main.d somelib.dylib"

 Thanks!
i don't remember exactly, but if this not work for you try something like this dmd main.d -L-L/path/to/lib.dylib i think there was a topic on this on wiki
That worked! Just one too many -L's though. It ended up being dmd main.d -L/path/to/lib.dylib
I have another question. Is there a way to specify a search directory and then link to each dylib? I have someone that I'm trying to help by the way, and I don't have a Mac :P I was pretty sure that -L-L/path/ seemed to be the way to add the search directory, but if I have a dylib named libsomelib.dylib, would I pass -Lsomelib, -Llibsomelib.dylib, -Lsomelib.dylib, or something else? Thanks for you help. P.S. Only a guide for compiling and linking on Windows is in the wiki. That should definitely be changed.
with libglfw.dylib it works for me evilrat$ dmd test.d -L-L/Users/evilrat/Documents/prog/glfwbuild/osx/_install/lib -L-lglfw note that first -L is dmd flag to pass linker options, but if you linking just single lib you can simply add it as source file like this "dmd test.d testlib.a"
Jul 19 2013
parent "Jeremy DeHaan" <dehaan.jeremiah gmail.com> writes:
On Saturday, 20 July 2013 at 04:26:45 UTC, evilrat wrote:
 with libglfw.dylib it works for me

 evilrat$ dmd test.d 
 -L-L/Users/evilrat/Documents/prog/glfwbuild/osx/_install/lib 
 -L-lglfw

 note that first -L is dmd flag to pass linker options, but if 
 you linking just single lib you can simply add it as source 
 file like this "dmd test.d testlib.a"
That worked perfectly! Thank you very much!
Jul 20 2013