On Friday, 15 May 2015 at 19:39:53 UTC, TJB wrote:
Off the top of my head: does adding -L-L$(pwd) help?

This is what I get:

$ dmd main.d -L-L$(pwd) -lhello
Error: unrecognized switch '-lhello'

Sorry if this is completely elementary and I am being quite dumb.

Thanks,
TJB

should be

$ dmd main.d -L-L$(pwd) -L-lhello

The -L means "send the following argument to the linker". Note that you may also find you need to help OS X find the dylib when running the program, either by moving it to one of the system locations or using DYLD_LIBRARY_PATH or DYLD_FALLBACK_LIBRARY_PATH (see http://stackoverflow.com/questions/3146274/is-it-ok-to-use-dyld-library-path-on-mac-os-x-and-whats-the-dynamic-library-s). However, I think the runtime linker looks in the present directory by default, so you might get away with it.

Reply via email to