readline / Gnu readline

Michael michaelhusmann at gmail.com
Thu Jan 30 06:12:32 UTC 2020


On Wednesday, 29 January 2020 at 21:15:08 UTC, Adam D. Ruppe 
wrote:
> On Wednesday, 29 January 2020 at 20:01:32 UTC, Michael wrote:
>> I am new to D.
>> I would like to use the Gnu readline function in D. Is there a 
>> module that i can use?
>
> just define it yourself
>
> ---
>
> // this line right here is all you need to call the function
> extern(C) char* readline(const char*);
>
> import core.stdc.stdio;
>
> void main() {
>     char* a = readline("prompt> ");
>     printf("%s\n", a);
> }
>
> ---
>
> # and also link it in at the command line with -L-lreadline
>  dmd rl -L-lreadline
>

>
>
> readline is so simple you don't need to do anything fancier. If 
> you need history and such too you just define those functions 
> as well.

Dear Adam,

I did exactly just what you proposed.

When 'dmd rl -L-lreadline' in the command line. I do get the 
following error:
Error: module rl is in file 'rl.d' which cannot be read.

So probably I'm missing something unfortunately I don't know what.


More information about the Digitalmars-d-learn mailing list