# New Ticket Created by NotFound # Please include the string: [perl #55154] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=55154 >
readline is not detected when building with C++, because the detection and the usage code declares directly the functions used without C linkage specification. This patch fixes the problem, and also do a minor cleaning in the set_readline_interactive method of parrotio.pmc. -- Salu2
Index: src/pmc/parrotio.pmc =================================================================== --- src/pmc/parrotio.pmc (revisión: 28004) +++ src/pmc/parrotio.pmc (copia de trabajo) @@ -24,9 +24,15 @@ #include "../src/io/io_private.h" #ifdef PARROT_HAS_READLINE -extern char *readline(const char*); +#ifdef __cplusplus +extern "C" { +#endif +char *readline(const char*); void add_history(const char*); +#ifdef __cplusplus +} #endif +#endif pmclass ParrotIO need_ext { @@ -171,25 +177,25 @@ METHOD set_readline_interactive(INTVAL on) { ParrotIO * const io = (ParrotIO *)PMC_data(SELF); -#ifdef PARROT_HAS_READLINE - INTVAL flag; -#endif if (!io) RETURN(INTVAL -2); - if (!(io->flags & PIO_F_READ)) RETURN(INTVAL -2); + #ifdef PARROT_HAS_READLINE - if (on && !(io->flags & PIO_F_CONSOLE)) - RETURN(INTVAL -2); - flag = !!(io->flags & PIO_F_READLINE); + { + INTVAL flag; + if (on && !(io->flags & PIO_F_CONSOLE)) + RETURN(INTVAL -2); + flag = !!(io->flags & PIO_F_READLINE); - if (on) - io->flags |= PIO_F_READLINE; - else - io->flags &= ~PIO_F_READLINE; + if (on) + io->flags |= PIO_F_READLINE; + else + io->flags &= ~PIO_F_READLINE; - RETURN(INTVAL flag); + RETURN(INTVAL flag); + } #else RETURN(INTVAL -1); #endif Index: config/auto/readline/readline.in =================================================================== --- config/auto/readline/readline.in (revisión: 28004) +++ config/auto/readline/readline.in (copia de trabajo) @@ -11,8 +11,14 @@ * the typedefs or prototypes of readline. Let's boldly make stuff up * and even lie for the sake of this test. */ -extern char* readline(const char*); -extern void* rl_get_keymap(void); +#ifdef __cplusplus +extern "C" { +#endif +char* readline(const char*); +void* rl_get_keymap(void); +#ifdef __cplusplus +} +#endif int main(int argc, char *argv[]) {