|
From: | felix winkelmann |
Subject: | Re: [Chicken-users] c-string arguments stack-allocated? |
Date: | Thu, 15 Jun 2006 21:18:44 +0200 |
On 6/14/06, John Cowan <address@hidden> wrote:
Is it correct that the NUL-terminated string passed to a foreign function is stack-allocated, and therefore must be copied with strdup() or similar if it is to be kept? Attempts to call free() on such a string seem to reliably crash Chicken.
The string may be stack-allocated or allocated in the heap (and so may move). To keep it on the C-side, do a strdup(). (felix)
[Prev in Thread] | Current Thread | [Next in Thread] |