Summary

getstr function in ncurses egg

Metadata

Description

Hi, I'm not expert about Chicken Scheme and easyffi, so I tried to read the source of the ncurses egg but I did not come up with it. I'm using Chicken 4.13 and the last version of the egg (i.e. 1.6) installed with "chicken-install ncurses". The problem is this:

 (require-extension ncurses)
 
 (let ((stdscr (initscr)) (str (make-string 10)))
   (getstr str)
   (addstr str)
   (getch))

The error is this:

 Error: bad argument type - not a pointer: "          "

It has been a similar problem: https://bugs.call-cc.org/ticket/158#no2 but it says that it has been solved now (but I still obtain an error, different from the one mentioned).

Changes and comments

[2018-01-07 16:20:45 UTC] megane wrote:

Using make-locative from lolevel works: (getstr (make-locative str)).

[2018-01-08 20:33:36 UTC] andrea wrote:

Is this the correct behaviour? Have I to close the ticket?

[2021-04-11 16:53:00 UTC] felix changed status from new to accepted

[2021-04-11 16:53:00 UTC] felix set owner to felix

[2021-04-18 17:34:24 UTC] felix changed status from accepted to closed

[2021-04-18 17:34:24 UTC] felix set resolution to wontfix

[2021-04-18 17:34:24 UTC] felix wrote:

Yes, this is actually the correct behaviour. We can't just pass a string, as it will be copied and modifications will not be reflected in the passed argument. A better API would handle that, but that would be backwards-incompatible. So megane's suggestion is the obscure, but correct, answer.

Sorry for taking 3 years to answe. It was simply forgotten...