Linking to Dynamic Library on Mac OS X
John Colvin via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri May 15 00:14:08 PDT 2015
On Friday, 15 May 2015 at 03:33:47 UTC, TJB wrote:
> 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
Off the top of my head: does adding -L-L$(pwd) help?
More information about the Digitalmars-d-learn
mailing list