Linking to Dynamic Library on Mac OS X

TJB via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 14 20:33:46 PDT 2015


I have built a toy dynamic shared library on Mac OS X (in C), and 
I have verified that it works from C. Now I would like to call it 
from D. So I have created the following interface file:

$ cat hello.di
extern (C):
     void printHelloWorld();

which I try to compile and run. But I get the following error:

$ dmd main.d -L-lhello
ld: library not found for -lhello
clang: error: linker command failed with exit code 1 (use -v to 
see invocation)
--- errorlevel 1

I gather that mac os x doesn't know where to find libhello.dylib 
(it is in the current directory). So how do I pass that 
information?

Thanks!
TJB


More information about the Digitalmars-d-learn mailing list