DUB and pragma lib - OSX
rikki cattermole via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Apr 19 23:16:35 PDT 2016
On 20/04/2016 5:53 PM, Joel wrote:
> How do I get this C stuff working with DUB? I tried putting the pragmas
> in the main source file.
>
> extern(C) char* readline(const(char)* prompt);
> extern(C) void add_history(const(char)* prompt);
>
> pragma(lib, "readline");
> pragma(lib, "curses");
>
> Linking...
> Undefined symbols for architecture x86_64:
> "_add_history", referenced from:
> _D5mmisc7getLineFAyaZAya in bookkeeping.o
> "_readline", referenced from:
> _D5mmisc7getLineFAyaZAya in bookkeeping.o
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
> --- errorlevel 1
> dmd failed with exit code 1.
> Joels-MacBook-Pro:BookKeeping joelcnz$
>
> The C stuff works without DUB.
Dub does separate compilation and linking.
Add them as "libs": ["readline", "curses"] for dub.json (sdl is a bit
similar).
More information about the Digitalmars-d-learn
mailing list