chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-janitors] #1424: (const c-string) as result type breaks with NU


From: Chicken Trac
Subject: [Chicken-janitors] #1424: (const c-string) as result type breaks with NULL
Date: Wed, 08 Nov 2017 14:25:11 -0000

#1424: (const c-string) as result type breaks with NULL
----------------------+-------------------------------
 Reporter:  wasamasa  |                 Owner:
     Type:  defect    |                Status:  new
 Priority:  minor     |             Milestone:  4.13.0
Component:  compiler  |               Version:  4.11.0
 Keywords:  foreign   |  Estimated difficulty:
----------------------+-------------------------------
 I'm writing bindings to a library which uses `const` on both string
 argument and return types.  If I declare a foreign function returning
 `NULL` to have `(const c-string)` as return type, I get a segmentation
 violation, `c-string` as return type however returns `#f` as expected.

 Minimal repro:

 {{{#!scheme
 (import chicken scheme foreign)

 #> static const char* test() { return NULL; } <#

 (define test (foreign-lambda c-string "test"))
 (define test2 (foreign-lambda (const c-string) "test"))

 (test) ;=> #f
 (test2) ;=> segfault
 }}}

--
Ticket URL: <https://bugs.call-cc.org/ticket/1424>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]